DocsTheme structure & publishing
On this page

Build admin actions

Add location controls, guarded actions and site settings.

Before you begin: Add custom admin pages.

Choose a Map Location

Use window.$themeAdmin.pickLocation(currentValue, title, searchQuery?) to let an administrator search for a place and adjust its map pin. The optional searchQuery prefills the search bar when no location has been selected. An existing selection takes precedence. It returns the selected location, or null when cancelled. Keep a customer-facing address in its own field when it should differ from the map location.

js

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

Bind a button click to choosePickup() through the page's FQL state declaration. A selected location contains address, longitude, latitude, and a two-letter countryCode. Declare matching post fields in FRL and save them with the normal form submission. Cancellation leaves your existing form values intact. The picker provides address search, a draggable pin, and keyboard navigation without requiring an API key.

Page Boundaries

Management pages run in an isolated frame and do not receive fb-admin's real authentication token or browser storage. Supported FQL queries, post writes, named FRL endpoints and file uploads use the administrator's authenticated session. Requests to account credentials, secret settings and the source editor are unavailable from embedded pages. GET forms can navigate between management pages. Use FQL submit bindings for data writes. Use .live bindings to keep admin records and processing progress up to date automatically. Existing FRL permissions still govern every read. Persistent browser storage is unavailable in management pages. Browser-owned APIs such as direct window.location assignment, cross-origin popups, and access to the parent page remain isolated; use the ordinary Frontbacked navigation APIs for script-driven navigation.

See themes/shipping/backend/admin.json and themes/shipping/admin/ for complete list, create, review and edit examples.

Build Custom Actions

Build action forms in your admin HTML and call ordinary FRL endpoints with Frontbacked.endpoints.call(). Send the selected user or record ID in the request body. The endpoint checks the required admin permissions, verifies its target, and queues the permitted changes. Post schemas validate every related write before it is saved.

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.

Declare accounts and its note schema in your theme. Queue only the fields the action should change; do not forward the whole request body. Use must for action-specific checks and retain the form state when an endpoint rejects a request. Add a review step for actions that change balances or issue cards.

The bank example includes card issuing and account-balance forms, plus a paginated card list. Its account-number and user-ID filters resolve the matching account on the server, then use that account ID in the FQL card query. Filters never require downloading all accounts or cards.

Manage Site URLs use /fb-admin/site-manager/{page-without-extension}. For example, /admin/products/edit.html opens at /fb-admin/site-manager/products/edit?id=123. Nested folders are preserved. Direct visits, reloads and browser Back/Forward use the same authenticated page loader.

Editing theme source

Code Editor opens HTML, styles, scripts, metadata, and backend files such as backend/index.frl together, with FRL highlighting and inline validation. Save changes as a draft, preview them, and publish when ready. Secrets and managed files remain unavailable.

Developer access

When you own both a site and its current theme, enable Developer access for an admin from the site's Admins tab in your Frontbacked dashboard. This grants Code Editor, Endpoints and External Requests access. Other content permissions do not grant Developer access, and site admins cannot grant it themselves. Access is checked again whenever the site or theme ownership changes.

Code Editor saves a draft for that site. Publishing that draft updates that site; releasing a theme update to subscribers remains a separate theme-owner action. Secrets and platform-managed files remain protected.

Store Site Settings in a Post

Give your theme its own settings schema and editing page. Keep credentials in Secret Keys, which appears directly above Manage Site. Business settings such as checkout limits belong in posts, where you can use the same validation and permissions as the rest of your theme.

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 fixed unique key permits one site-wide settings record. Reads are restricted to administrators with permission to view it. Your FRL helpers can use the saved value during checkout, while a default keeps the site working before settings are saved. Use FQL state bindings and Frontbacked.schemas.post() to build your settings form. Create the record on the first save and update its ID on subsequent saves, or use a guarded FRL endpoint for that action.

For working examples, see themes/bank/admin/settings.html and themes/wig-store/admin/settings.html. The built-in Posts screen is a read-only inspector; create, edit, and delete workflows belong in your theme's admin pages. Per-user business restrictions also belong in theme data and FRL permissions.