Metadata ladder
Above field-level metadata sit two more rungs — collection and vault identity — that viewers consume without duplicating their own label logic.
The field-level descriptors (fieldMeta / DescribedField) are the bottom rung
of a three-rung metadata ladder:
field → collection → vault
Each rung adds a friendly identity layer that viewers (devtools, editor, export filename, API doc) consume without duplicating their own label logic.
collectionMeta
Declare via the meta collection option:
const invoices = vault.collection<Invoice>('invoices', {
meta: {
label: 'Sales Invoices',
description: 'Outbound sales invoices billed to clients.',
pluralLabel: 'Sales Invoices', // for list headers
icon: 'receipt', // semantic icon name (Lucide etc.)
},
fieldMeta: { … },
})
CollectionMeta members:
| Field | Type | Purpose |
|---|---|---|
label | string? | Friendly collection name; falls back to the humanized collection name |
description | string? | Longer tooltip / context |
icon | string? | Semantic icon name (e.g. a Lucide key), not styling |
pluralLabel | string? | Plural form for list headers ("Invoice" → "Invoices") |
Unlike FieldMeta.label, CollectionMeta.label is optional — the
collection name is already a reasonable fallback identity.
First-wins reconciler. When a collection is pre-created by an MV before the
app's own vault.collection() call, the first declared meta wins (mirrors
_applyFieldMeta).
Surfaces in:
collection.describe()→CollectionDescription.metavault.dumpSchema()→CollectionDescriptor.metain-devtoolssnapshot()→InspectorCollection.meta
vaultMeta
Declare via the meta vault option:
const vault = await db.openVault('ledger', {
meta: { label: 'Acme Ledger 2026', description: 'Main accounting vault.' },
})
VaultMeta members:
| Field | Type | Purpose |
|---|---|---|
label | string? | Friendly vault name; falls back to the vault name |
description | string? | Longer context |
icon | string? | Semantic icon name |
First-wins. Re-opening an already-cached vault keeps its meta.
Surfaces in:
vault.dumpSchema()→VaultSchemaSnapshot.metain-devtoolssnapshot()→InspectorSnapshot.meta
Cargo export. CollectionMeta and VaultMeta are also exported from
@noy-db/hub/cargo (the klum orchestration seam) so that klum-db's federation
layer can reuse VaultMeta for groupMeta without taking a full hub dep.
See also
- Field metadata — the describe() contract these extend