Skip to content

CollectionConfigInput

Defined in: packages/core/src/collections/types.ts:249

Configuration input for a defineCollection() call.

A collection maps to a Convex database table. slug becomes the table name, fields defines its shape, and labels controls how the collection appears in the admin panel. Omitted labels are inferred from the slug.

Defaults applied by defineCollection():

{
labels: {
singular: "Post", // title-cased from slug ("posts" → "Post")
plural: "Posts", // title-cased + pluralised from slug
}
}
defineCollection({
slug: "posts",
fields: {
title: text({ required: true }),
body: richtext(),
},
})

TFieldMeta extends object = { }

TCollectionMeta extends object = { }

TCollectionSlug extends string = string

TFieldSlug extends string = string

TComponent extends ComponentHKT = ComponentHKT

optional admin?: AdminCollectionConfigInput<TFieldSlug, TComponent>

Defined in: packages/core/src/collections/types.ts:257

Admin panel behaviour for this collection. All properties are optional.


fields: Record<TFieldSlug, AdminField<TFieldMeta>>

Defined in: packages/core/src/collections/types.ts:271

Field definitions that make up this collection’s document shape.


optional indexes?: object[]

Defined in: packages/core/src/collections/types.ts:275

Index definitions that create indexes on this collection in Convex.

fields: NoInfer<TFieldSlug>[]

name: string


optional interfaceName?: string

Defined in: packages/core/src/collections/types.ts:273

Override the PascalCase interface name used in generated TypeScript types. Inferred from slug by defineCollection if omitted.


optional labels?: object

Defined in: packages/core/src/collections/types.ts:264

Display names shown in the admin panel navigation and list views. Both are inferred from slug if omitted.

optional plural?: string

Plural display name (e.g. "Posts"). Inferred from slug if omitted.

optional singular?: string

Singular display name (e.g. "Post"). Inferred from slug if omitted.


optional meta?: TCollectionMeta

Defined in: packages/core/src/collections/types.ts:279


slug: TCollectionSlug

Defined in: packages/core/src/collections/types.ts:259

Convex table name — used as the database table identifier and URL slug in the admin panel.