This documentation is available as Markdown for AI agents and LLMs. See the full Markdown index at /llms.txt, or add .md to any page's URL.
Recipe: a Snapback backend (shared server data)
For shared server data, exact new app --snapback writes a guestbook and wires its driver, generated operations and device.
This needs the Snapback client at <exact2>/snapback4/, absent from this
repository; in a checkout without it, exact new --snapback
and bun exact.mjs snapback refuse, naming the missing client.
For shared server data, bun <exact2>/scripts/exact.mjs new app --snapback [--port <n>] from the backend’s directory writes a guestbook and wires its
driver, generated operations and device. The default port is 4400.
bun exact.mjs snapback wires an existing app. With an existing schema, the
untouched greeting becomes a typed query and mutation explorer with --online.
snapback --port <n> records an ignored local backend selection.
At bake, .exact/backend-origin overrides app.ts's origin constant.
EXACT_BACKEND_ORIGIN or test web --backend <url> selects the origin at bake
time without editing authored source or tests. Plain-string grants move their
matching net.fetch line and a net.websocket line at the same host (ws: for
http:, wss: for https:). For grants keyed by origin, the selected origin
must have its own entry, except that a development build may take a loopback entry
for the same server at a LAN address; see keyed grants.
A native drive refuses a build baked for another backend than the one selected
(or app.ts's literal origin); --backend <url> drives it. A build with a
literal origin and no backend record must be rebuilt.
Where a checkout has the Snapback client, its snapback4/README.md covers
password sign-in, stored sessions and refresh with Contract time in “Personas
and password accounts”. This repository includes neither client nor guide.
A server-only schema takes --online; snapback and update preserve it.
On a plain scaffold, snapback --port <n> adds the origin and fetch/storage
grants. A computed origin or grants declaration needs an explicit edit.
After upgrading Snapback4, run bun exact.mjs snapback --rebuild.
bun exact.mjs update also rebuilds a mounted device after updating Exact.
Custom mounts: add --artifact-only to rebuild without rewiring.
app.json's typescript.sources are virtual import mounts: ./backend/api.ts
resolves through backend to ../snapback/generated/api.ts, and
./snapback4/snapback.ts resolves through snapback4 to the selected adapter.
These directories need not exist inside the app. snapback --rebuild
prints the resolved mappings.
The device's embedded snapback4.engine section records its identity;
assets/snapback4.wasm.json is derived diagnostic output.
snapback, contract build, test web and agent web refuse a stale device;
web drives compare it with the running server before opening the page.
The backend selection .exact/backend-origin is a build input; a test-only seed.json does not
make the build stale. Tests against the backend: testing against a Snapback backend; guests,
personas and password sessions: guests, personas and password sessions.
Connect my app to a Snapback backend
Paste this into Claude, Cursor, Codex, or another agent.
Is this helpful
Last updated November 15, 2026