DocsFRL reference
On this page

Schema reference

Look up field types and schema rules.

Before you begin: Actions and endpoints reference.

Schema Types

frl

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

type: "phone" accepts common phone formatting, then saves a normalized international number. type: "enum" saves one of the strings from enums. type: "money" stores exact decimal amounts in a multi-currency value; use money.getAmount(value), money.getCurrency(value), and money.format(value) inside FRL. Use money.resolve(value) to select the active supported shopping currency, use its exact saved price or convert the base price. An optional second argument selects a target currency within the site settings. See Currencies and prices. Use money.exchange(value, currency) to use a saved amount in that currency or automatically convert the base amount with a current exchange rate. For example, money.exchange($post.current.data.price, $currency.value) returns a money value in the shopper's selected currency. Conversion can fail temporarily when rates are unavailable; keep the customer's selections available for retry. Arithmetic helpers include money.add, money.subtract, money.compare, money.convertTo, and weighted money.allocate. On create, default fills a missing or null literal field before hooks and permissions run. serverTime fields are filled by Frontbacked before defaults and do not accept default. Inside FRL, $this.fields.status.enums.published returns "published" and $this.fields.status.hasEnum(value) checks whether a value belongs to that field.

type: "post" stores the generated ID of another post. Use postType to name the allowed target type. Frontbacked validates that the referenced post exists on the same site unless the field sets exists: false. Use IDs from $.id or $state.item.id, not slugs.

type: "user" stores a generated user ID. Submit the user ID string, not a copied user object. When a theme page asks for a visible reference field, Frontbacked expands it as a resource envelope: read profile values through owner.data.name and the generated identifier through owner.id. Nested post references use the same shape, such as product.data.category.data.name. Reference paths can expand up to five hops, which is enough for rich connected pages while keeping them fast. Use visibility: "author" or visibility: "backend" on the reference field when those details should not be returned to normal page visitors.

For page queries, automatic post-reference expansion supports targets with unconditional get and read access and no read rate limit. If a target uses a conditional access rule or a read rate limit, the reference remains an ID. Request that post separately with FQL so its access rules run normally.

Post references also work inside arrays and nested objects in a profile. Save an ID, then read current product details from $auth.data:

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.

For example, $auth.data.cart[0].product.data.name reads the current product name. Profile reads expand the post references declared anywhere inside the profile's objects and arrays, while stored profile values remain IDs. Product read permissions and field visibility still apply. A deleted or unreadable product returns { id, type, data: null }, so the UI can offer removal without showing stale details. exists: false lets a cart retain an unavailable product until its owner removes it. References within the returned product remain IDs unless requested separately through a product query.

Browser storage remains a saved value: opening a cart should request fresh products through FQL rather than display copied prices or images. Always calculate the payable total from saved product prices in the checkout endpoint.

Related writes follow the same schema rules as normal saves. If a related create or edit writes a post with required type: "post" or type: "user" fields, pass those IDs explicitly.

Continue with Field rules reference.