DocsData & access · FRL
On this page

Define record and account rules

Use post state and account lifecycle rules.

Before you begin: Protect your first record.

Post State

FRL separates saved data from the data being written, so rules stay easy to reason about.

PathMeaning
$post.current.dataThe saved data before this request. Use this for ownership, status, and previous-value checks.
$post.currentPost metadata for the saved post, such as id, type, author id, and status.
$post.pending.dataThe data this request wants to save. before create and before edit hooks write here.
$post.pendingPost metadata for the pending write, including the generated id during create.
ActionCurrent statePending state
createEmpty.The new post data and generated metadata.
editThe saved post before the edit.The merged post data that will be saved.
deleteThe saved post being deleted.Empty.
getThe saved post being fetched.Empty.
listNot available in list permissions because list checks run before rows are loaded.Empty.

Post Blocks

Every data record you want a theme to write or read is declared as a post.

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.

The post name is the type used by the frontend API:

js

Reference excerpt: use this with the page, variables and functions described in this guide. Try a complete example →

type: "money" stores an exact amount and currency. FQL returns a rich money object with safe methods such as $.price.getAmount(), $.price.getCurrency(), and $.price.format().

User Data And Lifecycle

Use user to validate custom user data and connect other records to the user lifecycle. The site admin decides whether registration, profile changes, and profile-photo changes are available, so a theme cannot grant those capabilities from FRL.

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.

$user.id always identifies the affected user. $actor.id identifies the person who initiated the action, which can be different when an admin deletes a user. $user.current, $user.pending, and $user.changes let hooks inspect safe identity fields and custom data without exposing passwords, hashes, or tokens.

The user schema validates data being created or edited; delete and sign-in hooks do not revalidate older stored data. Every account creation path—including email signup, provider signup, and accounts created by a site admin—runs after create. If required user data is missing or a related write fails, the account is not partially created. Use after create, after edit, and after delete for related writes. after signIn runs after successful authentication and cannot turn valid credentials into a failed sign-in. The older profile spelling remains available while themes migrate, but user is the current form.

The frontend updates custom data with Frontbacked.updateUserData({ data, merge }). With merge: true, the submitted object is merged into existing data; with merge: false, it replaces existing data after schema validation.

Continue with Use request and event context.