Skip to content

Client internals

Client internals

The browser client behind $bolt is small and name-erased: the typed bolt a page imports is the same object at run time, and every type comes from the names index at build.

Queries

A read builds a query that has not run. await sends one POST /__bolt/q; bolt.live registers the view on the tab’s stream, keyed by the query’s canonical form, and keeps it while something renders it, with a 30 s grace.

The stream

Each visible tab opens one EventSource. The first frame for a view is its answer, and later frames patch it in the stream’s order. A patch at or below the view’s sequence is ignored, and one that does not fit re-registers the view, whose new answer resyncs it. A tab hidden for 30 s closes its stream.

Writes

act sends one POST /__bolt/act with a client-minted idempotency key, and never rejects. Generated writes paint optimistically over the live reads they touch: the client tracks each row’s revision, sends it with an update, and settles the paint on the outcome. start mints the run id in the client, so a retried start is one run.

Decoding view state

bolt.decode runs the host’s strict filter decoder in the browser against the viewer’s collection exposure, so a filter or sort from a URL is kept or dropped one condition at a time before any read.

No browser replica

The server is the authority. There is no durable browser store, no offline queue and no cross-tab broker, and drafts live in their form until the outcome.