Browse documentation

Design Schema Reference

Exhaustive field-level spec for public.types.design_schema — the JSON every type carries and every runtime record is stamped with at creation. The mental model is in Design Schema; this page is the lookup table. The TypeScript source of truth is DesignSchema, FieldDefinition, ViewFieldConfig, ListView, DetailView, and FunctionalityBindings in .framework/src/types/types.ts.

Top-level shape

KeyTypeRequiredPurpose
fieldsRecord<string, FieldDefinition>yesFlat map of snake_case field names to definitions
viewsRecord<string, View>yes for generic appsdefault_list and default_detail drive the generic UI
record_permissionsRecord<string, string[]>yesBase CRUD grant per role slug
scope"account" | "platform"no (default "account")Which account owns records of this type at create
functionalityFunctionalityBindings or extensionsnoAutomation bindings; null until a binding is confirmed live
display_fieldstringnoField used for record titles in detail pages

validate-schema enforces: fields non-empty; every field has data_type, label, required; record_permissions grants at least system_admin (and rejects the dead system-admin slug — permission keys must match roles.slug verbatim); scope is account or platform (.framework/cli/commands/validate-schema.ts).

fields.<name> — FieldDefinition

KeyTypeNotes
data_typeenum, see belowrequired
labelstringrequired
requiredbooleanrequired; enforced client-side by useForm (.framework/src/hooks/useForm.ts), propagated into validation_schema
systembooleantrue → top-level record column; absent/false → record.data.<name>
placeholderstringinput hint
descriptionstringhelp text
namestringoptional field alias
rowsnumbertextarea height hint
min, max, stepnumberrange input bounds
readonly, disabledbooleanform-state hints
validationobjectconstraint keys, see below
options(string | {value, label})[]required for select, multiselect, radio
permissionsRecord<string, string[]>per-role field overrides, read/write only

data_type values

The authoritative dispatch is sanitizeFieldData in .framework/functions/_shared/schema-utils.ts. Unknown types are not rejected — the value passes through unsanitized and unvalidated.

Where the sanitizer runs. sanitizeFieldData executes only on the admin-data update path, only for data.* (non-system) fields, and only for non-system-admin principals. create performs no field sanitization — the request body is inserted as-is — and system columns (system: true, including select fields like status) are never option-validated server-side. required is enforced client-side by useForm only. So "sanitizer behavior throws" below means: on a data.* update by a non-admin caller. The trust boundary is the client + field permissions, not validation_schema — treat API writes as unvalidated input.

data_typeStored asSanitizer behavior
textstringtrim, strip control chars; minLength throws, maxLength truncates, pattern throws
textareastringtrim, strip control chars; minLength/maxLength
rich_textHTML stringtag allowlist (p br strong em u ol ul li a h1–h6), strips <script> and on*= handlers; minLength/maxLength
emailstringlowercase + trim; must match ^[^\s@]+@[^\s@]+\.[^\s@]+$
phonestringstrips non-0-9+ chars; optional pattern
urlstringparses URL; http:/https: only; normalized via URL.toString()
numbernumberNumber() coercion; min/max throw; step snaps down to step
currencynumberNumber() coercion rounded to 2 decimals; min/max throw
rangenumbersame as number
date"YYYY-MM-DD"parses any Date() input, stores ISO date; min/max bounds
datetimeISO stringparses any Date() input, stores toISOString(); min/max bounds
booleanbooleantrue/false pass through; strings "true" "1" "yes" "on" → true, "false" "0" "no" "off" → false; anything else throws
checkboxbooleanalias of boolean
selectstringtrim; when options are declared the value must match an option (value for {label,value} entries) or it throws
multiselectstring[]accepts an array or comma-separated string; dedupes; each element must match an option; validation.max truncates the list
radiostringsame sanitizer as select
colorstringmust match #rgb/#rrggbb; normalized to 6-digit uppercase hex
fileobjectmust be an object with .name; maxSize and allowedTypes (MIME) enforced; filename sanitized to [a-zA-Z0-9.-]
imageobjectsame sanitizer as file (maxWidth/maxHeight are declared but not enforced)
jsonany JSON valuestring input is JSON.parsed; rejects script tags, javascript:, eval(/function(, on*= handlers, and __proto__ keys; arbitrary nesting allowed under data.<name>
referencestring (uuid)must match the UUID regex; validation.reference_kind/reference_type describe the target
addressobjectmust be an object; string values are text-sanitized

formatFieldData (display formatting) covers only json, date, datetime, currency, phone, url, reference, address, multiselect, boolean — all other types render raw.

validation.* keys

Declared on FieldDefinition.validation; copied verbatim into the generated validation_schema by generateValidationSchema (.framework/functions/_shared/schema-utils.ts).

KeyApplies toEffect
patterntext, phoneregex must match or the write throws
minLength, maxLengthtext, textarea, rich_textmin throws; max truncates
min, maxnumber, currency, range, date, datetimebounds; out-of-range throws
stepnumber, rangevalue snapped down to step multiple
integernumberdeclared; not enforced by the server sanitizer
precisionnumberdeclared decimal precision; not enforced server-side
maxSizefile, imagebyte-size limit, enforced server-side
allowedTypesfile, imageMIME allowlist, enforced server-side
maxWidth, maxHeightimagedeclared; not enforced server-side
maxmultiselecttruncates the list to max entries
currency_codecurrencydisplay currency (e.g. USD)
reference_kindreferenceruntime table of the target (item, person, account, …)
reference_typereferencetype slug of the target record

options formats

Required for select/multiselect/radio; validated non-empty by validate-schema. Both forms accepted:

"options": ["todo", "done"]
"options": [{ "label": "Bug", "value": "bug" }]

permissions (field-level overrides)

record_permissions is the base, most restrictive grant: when a role can read/update a record, every field defaults to read/write unless the field declares a permissions entry for that role. Field-level actions are read and write only; create/delete are record-level (.framework/functions/_shared/permissions.ts, resolveFirstSurfacePermissions step 5–6). Use field permissions to loosen one field beyond the record grant or to re-restrict a system: true field.

"fields": {
  "cost": {
    "data_type": "currency", "label": "Cost", "required": false,
    "permissions": { "member": ["read"], "finance": ["read", "write"] }
  }
}

system flag semantics

system: true fields are stored as top-level record columns (record.title), all others under record.data.<name> — see Runtime Records. Writers split payloads the same way (useEntityRecord / the update path). Conventionally title is system; flag system: true fields that humans must not edit with a permissions override restricting write to system_admin.

views

views is a map of view names to ListView | DetailView. Generic apps (apps.renderer = "generic") need default_list and default_detail; a custom app may omit views but loses the generic admin/runtime fallback.

default_list — ListView

KeyTypePurpose
type"list"required discriminator
display"table" | "card" | "board"layout in GenericListPage
labelstringview title
fieldsRecord<string, ViewFieldConfig>column map, keyed by field name (may include created_at/updated_at). Non-system fields resolve automatically — key priority reads record.data.priority; the explicit data.priority form also works and filters on data.<field> are translated server-side
default_sort{field, direction: "asc"|"desc"}initial ordering
filters(string | EntityFilter)[]filter affordances — a bare field-name string is normalized from the field def (select → enum with its option values, boolean → boolean, else search); or pass full {key, label, type: "search"|"enum"|"boolean", options?: string[]} objects
stats{title, type: "count"|"filter_count", icon?, color?, filter?}[]stat cards above the list; filter is a {<field>: <value>} map matched per row (e.g. {"status": "todo"})
group_bystringfield to group rows by (board display)

default_detail — DetailView

KeyTypePurpose
type"detail"required discriminator
labelstringpage title
sectionsDetailViewSection[]ordered sections of {title, fields: Record<string, ViewFieldConfig>}

ViewFieldConfig — display_type

Each view field is {display_type, sortable?, searchable?}. Implemented display_type values — enforced by validate-schema and rendered by .framework/src/components/shared/FieldRenderer.tsx:

display_typeContext
textread-only text (list/detail)
badgestatus pill (list)
timestampformatted date/time (list/detail)
currencyformatted amount
numberformatted number
inputsingle-line edit input (detail)
textareamulti-line edit
rich_textrich-text editor
select, multiselect, radiooption pickers
checkbox, switchboolean toggles
date_picker, datetime_pickerdate/time pickers
color_pickercolor input
file_upload, image_uploadupload widgets
range_slidernumeric slider

Reserved in ViewFieldConfig but not yet implemented by FieldRenderer: rating, autocomplete, address_form, reference_picker (the type union admits them in .framework/src/types/types.ts; treat as forward-compatible placeholders).

record_permissions

"record_permissions": {
  "system_admin": ["create", "read", "update", "delete"],
  "admin":        ["create", "read", "update"],
  "member":       ["read"]
}
  • Actions are create, read, update, delete — evaluated per request against the caller's role slug.
  • "all" is a wildcard role granted to every authenticated principal that passed RLS; always evaluated when present (.framework/functions/_shared/permissions.ts).
  • Evaluation happens against the schema stamped on the record, not the type row — records created before a schema edit keep the old grant.
  • If a type's design_schema omits record_permissions, admin-data create merges a permissive default {all: [create,read,update,delete]} before stamping (.framework/functions/admin-data.ts, PERMISSIONS_ALL). An explicit empty object denies everything downstream — always author deliberately.

scope

Read at create time as designSchema.scope ?? 'account' (.framework/functions/admin-data.ts). "platform" stamps new records with the spine-system account id; records created against a parent (thread_id, target_id, parent_id) inherit the parent's stamped scope. See Scope and Accounts.

functionality

FunctionalityBindings (.framework/src/types/types.ts) declares optional automation:

BindingShape
pipelines[]{pipeline_id, trigger: manual|on_create|on_update|on_field_change|on_delete|scheduled, field?, condition?, roles[]}
ai_agents[]{agent_id, capabilities: (read|summarize|suggest|update)[], trigger, roles[]}
embeddings[]{slug, fields[], model, vector_column, trigger}
integrations[]{integration_id, sync: bidirectional|inbound|outbound, field_map, trigger}
constraints[]{type: unique|conditional_required|immutable, fields?/field?, condition?, message, after?: create|update}

admin-data also reads functionality.lineage ({parent_fields: string[], link_type: string, children: {[slug]: field}}) on items get/list to attach parents/children — declared per type in the seed, interpreted by attachLineage in .framework/functions/admin-data.ts. Set functionality to null until the binding you need is confirmed live.

validation_schema (generated, never authored)

generateValidationSchema derives {fields: {name: {data_type, required, ...validation, options, reference_kind?, reference_type?}}} from design_schema.fields on every type create and on every update that touches design_schema (.framework/functions/types.ts, .framework/cli/commands/install-app.ts seed path). Never hand-edit — change design_schema and let the writer regenerate it.

Framework documentation — Verified November 20, 2026 · source revision 35992a9.

Was this page helpful? Ask a question · Report a documentation problem