Schema Format Reference
Complete TypeScript type definitions for the schema-registry.json format.
Schema Format Reference
The schema registry is a JSON file with a well-defined structure. Below are the complete TypeScript type definitions used by both the compiler (to generate) and the CMS (to consume).
SchemaRegistry
The top-level type:
interface SchemaRegistry {
generatedAt: string;
generatedBy: string;
version: string;
features: Record<string, string[]>;
tables: Record<string, TableMeta>;
tablesByFeature: Record<string, string[]>;
}| Field | Description |
|---|---|
generatedAt | ISO 8601 timestamp of when the registry was generated |
generatedBy | Always "quickback-compiler" |
version | Compiler version string |
features | Map of feature name to array of source file names |
tables | Map of camelCase table name to full table metadata |
tablesByFeature | Map of feature name to array of table names in that feature |
TableMeta
Full metadata for a single table:
interface TableMeta {
name: string;
dbName: string;
feature: string;
columns: ColumnMeta[];
firewall: Record<string, unknown>;
crud: Record<string, CrudConfig>;
guards: GuardsConfig;
masking: Record<string, MaskingRule>;
views: Record<string, ViewConfig>;
validation: Record<string, ValidationRule>;
actions: ActionMeta[];
displayColumn?: string;
inputHints?: Record<string, string>;
layouts?: Record<string, CmsLayout>;
internal?: boolean;
}| Field | Description |
|---|---|
name | camelCase table name (e.g., "accountCode") |
dbName | Snake_case SQL table name (e.g., "account_code") |
feature | Parent feature name (e.g., "accounting") |
columns | Ordered array of column metadata |
firewall | Tenant isolation config (organization, owner, softDelete, exception) |
crud | Per-operation (create, read, update, delete) access config |
guards | Field-level create/update/immutable/protected rules |
masking | Per-field masking rules keyed by column name |
views | Named column projections keyed by view name |
validation | Per-field validation rules keyed by column name |
actions | Array of action definitions for this table |
displayColumn | Column used as human-readable label (auto-detected or explicit) |
inputHints | Map of column name to preferred CMS input type (e.g., "select", "textarea", "checkbox") |
layouts | Named record page layouts keyed by layout name (see CmsLayout below) |
internal | When true, table is hidden from CMS sidebar |
ColumnMeta
Metadata for a single column:
interface ColumnMeta {
name: string;
dbName: string;
type: "text" | "integer" | "real" | "blob";
mode?: "boolean";
primaryKey: boolean;
notNull: boolean;
defaultValue?: string | number | boolean;
fkTarget?: string;
}| Field | Description |
|---|---|
name | camelCase property name |
dbName | Snake_case SQL column name |
type | SQLite storage type |
mode | When "boolean", an integer column represents true/false |
primaryKey | Whether this column is the primary key |
notNull | Whether the column has a NOT NULL constraint |
defaultValue | Static default value (strings, numbers, or booleans) |
fkTarget | Target table name for FK columns (e.g., "contact" for a vendorId column) |
CRUDConfig
Per-operation access control:
interface CrudConfig {
access?: AccessRule;
mode?: string;
}
interface AccessRule {
roles?: string[];
or?: Array<{
roles?: string[];
record?: Record<string, unknown>;
}>;
record?: Record<string, unknown>;
}| Field | Description |
|---|---|
access.roles | Array of roles allowed for this operation |
access.or | Alternative access conditions (any must match) |
access.record | Record-level conditions for access |
mode | Operation mode (e.g., "batch" for bulk create) |
GuardsConfig
Field-level control for create and update operations:
interface GuardsConfig {
createable: string[];
updatable: string[];
immutable: string[];
protected: Record<string, string[]>;
}| Field | Description |
|---|---|
createable | Fields that can be set during record creation |
updatable | Fields that can be modified on existing records |
immutable | Fields that can be set on create but never changed |
protected | Fields only modifiable via named actions (field name to action names) |
ActionMeta
Metadata for a custom action:
interface ActionMeta {
name: string;
description: string;
inputFields: ActionInputField[];
access?: {
roles: string[];
record?: Record<string, unknown>;
};
standalone?: boolean;
path?: string;
method?: string;
responseType?: string;
sideEffects?: string;
cms?: CmsConfig;
}
interface CmsConfig {
label?: string;
icon?: string;
confirm?: string | boolean;
destructive?: boolean;
category?: string;
hidden?: boolean;
successMessage?: string;
onSuccess?: 'refresh' | 'redirect:list' | 'close';
order?: number;
}
interface ActionInputField {
name: string;
type: string;
required: boolean;
default?: unknown;
}| Field | Description |
|---|---|
name | Action identifier (e.g., "approve", "applyPayment") |
description | Human-readable description shown in dialog |
inputFields | Array of input field definitions |
access.roles | Roles allowed to execute this action |
access.record | Record conditions (e.g., { status: { equals: "pending" } }) |
standalone | When true, action is not tied to a specific record |
path | Custom API path (overrides default) |
method | HTTP method (defaults to POST) |
responseType | "file" for download responses |
sideEffects | "sync" for actions with synchronous side effects |
cms | Optional CMS rendering metadata (label, icon, confirm, destructive, category, hidden, successMessage, onSuccess, order) |
ActionInputField
| Field | Description |
|---|---|
name | Field identifier |
type | Zod type string: "string", "number", "boolean", "array<string>" |
required | Whether the field must be provided |
default | Default value pre-filled in the form |
ViewConfig
Named column projection with access control:
interface ViewConfig {
fields: string[];
access: AccessRule;
}| Field | Description |
|---|---|
fields | Array of column names to include in this view |
access | Role-based access rules (same shape as CrudConfig access) |
CmsLayout
Named record page layout with ordered sections:
interface CmsLayout {
sections: CmsLayoutSection[];
}
interface CmsLayoutSection {
label: string;
fields: string[];
columns?: 1 | 2;
collapsed?: boolean;
}| Field | Description |
|---|---|
sections | Ordered array of field sections |
CmsLayoutSection
| Field | Description |
|---|---|
label | Section header text |
fields | Array of column names to display in this section |
columns | 1 (default) or 2 for two-column field layout |
collapsed | When true, section starts collapsed with a toggle to expand |
Fields not assigned to any section in the active layout are collected into an "Other Fields" section.
MaskingRule
Per-field data masking:
interface MaskingRule {
type: "email" | "phone" | "ssn" | "redact";
show: {
roles: string[];
or?: string;
};
}| Field | Description |
|---|---|
type | Masking pattern to apply |
show.roles | Roles that see the unmasked value |
show.or | Alternative condition for showing unmasked value |
Masking Patterns
| Type | Input | Output |
|---|---|---|
email | john@acme.com | j***@acme.com |
phone | (555) 123-4567 | ***-***-4567 |
ssn | 123-45-6789 | ***-**-6789 |
redact | Any string | ------ |
ValidationRule
Per-field validation constraints:
interface ValidationRule {
minLength?: number;
maxLength?: number;
min?: number;
max?: number;
enum?: string[];
email?: boolean;
}| Field | Description |
|---|---|
minLength | Minimum string length |
maxLength | Maximum string length |
min | Minimum numeric value |
max | Maximum numeric value |
enum | Array of allowed string values |
email | When true, validates email format |
Next Steps
- Schema Registry — How the registry is generated and used
- Components Reference — All CMS React components