Schema Declaration Overview

Schema declarations are the code-owned source for custom collections. Start with the stored data shape, add constraints and input intent, then compile and review the resulting database change.

import {
  bd,
  collection,
  createFormSchemaOrchestrator,
} from '@businessdash/sdk'

const projects = collection('projects', {
  fields: {
    title: bd.text().required(),
  },
})

export const definition = createFormSchemaOrchestrator([projects])
export default definition.databaseSchema

Progressive learning path

  1. Collections and CLI Changes — define the database boundary, inspect the artifact, and understand the draft/Live lifecycle.
  2. Primitive Builders — choose the stored value type.
  3. Field Modifiers — add nullability, defaults, indexes, documentation, and metadata.
  4. Validation — add field rules and understand the validators that consume them.
  5. Form Elements — attach renderer intent without changing the stored type.
  6. Enums — define stable fixed choices and inferred value unions.
  7. Relationships and Extensions — connect collections, control deletion behavior, and extend junction collections.

These pages describe the declaration language. To build a particular product flow, use Feature Integration after completing the relevant declaration pages.

If the distinction between databaseSchema, uiFormTree, and live visitor state is not yet clear, begin with Core Developer Concepts.