Postgres
The most common production setup: one Express (or any Node) route, a handful of concurrent queries, and a single JSON response that flux.bootstrap() reads in one network call per scope.
- A running Postgres database and a Node backend that can query it (pg, Prisma, Drizzle — any client works, examples here use pg directly)
- Tables with an updated_at column or a single-state flux_changelog table if you plan to use realtime delta catch-up — see Step 4
- Familiarity with api/bootstrap on the client side
A basic bootstrap route
{ ok, data, assets }. Keys inside data must exactly match the map object in your client-side flux.bootstrap() call.One network call, not one query
With three or more registered channels, sequential await calls add up fast on the client's perceived load time even though it's still technically one request. Promise.all keeps the queries concurrent server-side.
A 'user'-scope endpoint
'user'-scope bootstrap call is a separate endpoint, separate from the 'global' one — with its own leader lock, cooldown, and revalidation blueprint on the client (Section 4.13). Server-side, the only difference is that every query needs a WHERE user_id = ... clause, resolved from your own auth middleware, not from anything the client sends.Flux's BootstrapConfig.userId field exists purely for client-side IDB namespacing. Your endpoint must resolve the authenticated user independently — from a session cookie or verified token — and filter every query by that, never by a value read out of the request.
Delta queries for sync anchors
flux_changelog table. This handles row backfill, sparse field updates, and offline deletions when a channel reconnects with a non-zero SyncAnchorMap entry.Backing a handshake replay strategy
replayStrategy: 'handshake', you need a separate revalidation endpoint — this is what revalidateFn calls, once per endpoint group, with the full manifest of queued entries.What not to do
For MongoDB, see bootstrap/mongodb. For a framework-agnostic Node reference (including assets[] chunk warming for Next.js), see bootstrap/node. For any other backend language, see bootstrap/rest. For the client-side call this endpoint answers, see api/bootstrap.