DocsSchemas · FRL
On this page

Generate and protect field values

Use server time, generated values and immutable fields.

Before you begin: Validate file fields.

Server Time Fields

Use type: "serverTime" for timestamps that should be set by Frontbacked.

frl

Rule excerpt: add this to a complete FRL rule before running it. Try a complete example →

Choose setOn: "create" for a creation timestamp, setOn: "edit" for an edit timestamp, or setOn: "write" for every create and edit (the default). An immutable serverTime field can only use setOn: "create".

Frontbacked fills these timestamps before defaults and hooks run, and serverTime fields do not accept default. This keeps frontend clients from deciding trusted timestamps.

Generated Fields

Use generated: true for values supplied by trusted FRL logic rather than by forms or ordinary API payloads. Frontbacked removes caller-supplied values before before hooks run. On edit, the saved generated value is preserved unless trusted FRL logic replaces it. The final value must still satisfy its type, required, pattern, and other schema rules.

backend/index.frl
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.

generated does not make a field public. Use visibility: "author" or visibility: "backend" whenever the generated value needs restricted read access. Endpoints, payment events, and related post.* writes can also set generated fields explicitly.

Immutable Fields

Use immutable rules to protect fields during updates. Immutable validation runs on edit actions and compares $post.pending.data against $post.current.data.

frl

Rule excerpt: add this to a complete FRL rule before running it. Try a complete example →

Use editableIf when a field can change only under a specific guard. immutableUnless is an alias for editableIf; prefer one spelling consistently in a theme.

frl

Rule excerpt: add this to a complete FRL rule before running it. Try a complete example →

The guard can use the same rule context available to permission expressions.

Continue with Complete a record schema.