On this page
Initialize frontbacked.js
Load frontbacked.js and register your page functions.
Before you begin: Build your first form.
What FQL Handles
FQL handles common frontend jobs:
| Job | Example |
|---|---|
| State from DOM events | "email": "#email.oninput.target.value" |
| Form validation | await Frontbacked.state.check("signup", signupSchema) |
| Loading/re-entry guards | f-loading-text, f-loading-attr-*, frontbacked-loading |
| Page access gates | f-access="auth", f-redirect-to="/signin" |
| Provider sign-in | f-auth-provider="google" or f-auth-provider="github", f-auth-return-to="/dashboard" |
| Admin controls | f-admin-link, f-edit-mode-enable, Frontbacked.editMode.enable() |
| Component imports | f-insert="/components/header.html", f-replace="/components/footer.html" |
| Derived state | "title": "$state.product.data.title || 'Untitled'" |
| Live saved data | "messages.live": { "$list": "messages" } |
| URL and server values | "$query.plan", "$params.slug", "$siteInfo.name" |
| Frontbacked data requests | "$settings.site.name", "products{id:$query.id}.title" |
| DOM rendering | f-text, f-attr-*, f-list |
| Conditional visibility | f-show="$auth.exists", f-hide="$auth.exists" |
| File uploads | Frontbacked.createPost({ type, post }) with files anywhere in post |
| Upload recovery | Frontbacked.uploads.resume({ post }) |
| Image variants | Frontbacked.image.resize(post.image, { width: 640 }) |
| Adaptive video | Frontbacked.video.attach(video, post.video, options) |
| Programmatic playback | player.seekBy(10), player.appendVideo(nextVideo) |
| Billing flows | Frontbacked.endpoints.call("create_product_payment", { body }) followed by Frontbacked.billing.showPayment(...) |
| Theme skins | Frontbacked.setSkinMode("dark"), Frontbacked.skins.setSiteSkin("pink_atelier") |
| Support launcher | f-support-launcher, Frontbacked.supportLauncher.open() |
| Same-site navigation | Frontbacked.navigate("/dashboard") |
| Custom theme endpoints | Frontbacked.endpoints.call("endpointName", { body }) |
Initialization
Load frontbacked.js from the Frontbacked CDN, then call Frontbacked.init().
If you load the CDN script with defer, run your initialization from a deferred page script or a DOMContentLoaded handler so Frontbacked is available first.
Options:
| Option | Purpose |
|---|---|
endpoint | Base API path used for query, auth, and post requests. Defaults to /api. |
debug | Shows extra FQL details in the browser console while you build. |
state | Optional state declaration object. If provided, it is used before the {STATE} HTML comment. |
Register every page function that an FQL expression may call before initialization:
Reference excerpt: use this with the page, variables and functions described in this guide. Try a complete example →
Continue with Navigate between pages.