On this page
Define a record schema
Declare typed fields, defaults and searchable values.
An FRL schema is the contract for one post type. It lists every field Frontbacked will accept and rejects extra fields. This is one of the main protections that keeps published sites from accepting unexpected data.
Rule input (JSON)
Use a complete version 2 rule file. Select a post with “postType” and “action”, or an “endpoint” by name. Saved data, jobs, payments and email need the local server. Dedupe replay protection also needs a site.
Check complete rules or run schemas, permissions, hooks and calculations against the input above. Add excerpts to a complete rule before running.
New records follow the current schema. When editing a record, Frontbacked preserves values that have not changed, even if a newer schema uses a different type, adds a required field, narrows an enum, or tightens a limit. Only added or changed values must follow the current rules. Clearing a value counts as a change.
This applies to every field type, including files, objects, and arrays. Nested object fields and array items are compared at the same path and array index: editing one value does not require updating its unchanged neighbors. Changed objects and arrays must still meet their container rules, such as maximum length or key count. Values retained from fields removed from the schema can stay unchanged, but cannot be added or edited.
Edit permissions and lifecycle hooks still run. Values changed by a hook are validated too. Server-managed fields such as serverTime continue to follow their declared write behavior.
If the frontend adds a field that is not in the schema, validation fails.
Field Syntax
Each field is an object:
Rule excerpt: add this to a complete FRL rule before running it. Try a complete example →
Examples:
Rule excerpt: add this to a complete FRL rule before running it. Try a complete example →
Boolean rules use true, such as required: true, unique: true, or immutable: true.
The optional as label gives admin screens a friendlier label. It does not rename the stored field or change the FQL path.
default fills a missing or null literal field during create. Use it with string, email, phone, enum, number, boolean, and datetime fields. Defaults are available to before create and before write hooks, then the final value is validated like normal input. Edits do not auto-fill omitted fields.
generated: true marks a field as server-managed. Forms and direct API writes do not supply it. Set it from FRL hooks, endpoints, payment events, or related server-side writes, and control who can read it separately with visibility.
Continue with Set defaults and searchable fields.