Actions and endpoints reference
Look up post sections, hooks, list policies and endpoint blocks.
Before you begin: Declarations reference.
Post Sections
| Section | Purpose |
|---|---|
before create/edit/delete/write { ... } | Normalize and compute values before validation. Use comma groups such as before create, edit. |
after create/edit/delete/write { ... } | Run follow-up work after validation and permission checks pass. Use comma groups such as after create, edit. |
schema { ... } | Define allowed fields and validation rules. |
allow list(limit=20, max=100): expression | Set list visibility and default/max list sizes. |
allow create: expression | Guard create actions. |
allow get: expression | Guard single-post fetches. |
allow read: expression | Guard both get and list reads. Because it also protects list requests, keep it request-scoped. |
allow edit: expression | Guard update actions. |
allow delete: expression | Guard delete actions. |
allow write: expression | Guard create, edit, and delete actions with the same expression. |
allow create, edit: expression | Guard multiple named actions with one expression. Use allow read, write: expression when one broad condition should cover get, list, create, edit, and delete. |
Before and After Hooks
Use before for write-side data preparation before validation and permission checks. Use after for follow-up work after validation and permissions pass. Both hooks only run for write actions: create, edit, and delete. write means all three write actions, and comma-separated groups let you share logic between selected actions.
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.
after blocks are useful for audit logs, notifications, counters, and other related writes that should only happen after an action is accepted.
When more than one hook matches the current write action, Frontbacked runs them in source order and passes the same $context through each one. When more than one allow rule matches, every matching rule must resolve truthy. If a concrete action has no matching allow rule, Frontbacked denies it.
List Policies
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.
| Property | Purpose |
|---|---|
allow list(...): expression | Controls whether the current user can list this post type. |
limit | Default list size when the frontend does not provide one. |
max | Largest list size this post type allows. |
Use allow list: to decide whether the request is allowed to ask for a list. Use FQL where or filter to decide which rows should appear in the list. allow read: and allow list: cannot use post-scoped values such as $post, $row, or $rowMeta, even through helper functions; use allow get: when the permission depends on one specific post.
Endpoint Blocks
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.
| Section | Purpose |
|---|---|
must(expression, message?, status?, code?) | Assertion for required values. A falsy value stops the endpoint. |
mustNot(expression, message?, status?, code?) | Optional inverse guard that stops when the expression is truthy. |
dedupe expression | Optional stable key for repeat-safe requests. |
| Endpoint statements | Assign $context, call helpers, and return a JSON response directly inside the endpoint block. |
Use allow for post action/list permissions, and must(...) or mustNot(...) for endpoint and hook assertions. A failed must or mustNot stops the rule run; the optional second argument becomes the error message. The optional third argument sets the HTTP status returned by request-facing flows and must resolve to an integer from 400 to 599.
For endpoint failures, the optional fourth argument supplies a stable code alongside the human-readable error. Codes use lowercase letters, numbers, and underscores, start with a letter, and have at most 80 characters. For example:
Rule excerpt: add this to a complete FRL rule before running it. Try a complete example →
Use the code to choose retry behavior instead of matching error-message text.
Theme JavaScript calls the example by name with Frontbacked.endpoints.call("createLead", { body }). Direct HTTP callers can use /fb-endpoints/leads/submit. Use the endpoint alias to give admin screens a clearer label for the endpoint. Use Endpoints and Dedupe for the full guide.
Continue with Schema reference.