Skip to main content
Bijection ships two client entries: bijection/client, which runs anywhere JavaScript with streaming fetch runs, and bijection/react. Every framework uses one of them. Type the client from the app tree with a type-only import, as in the client.

React frameworks

Next.js, Remix and TanStack Start. Live views are client components: make the client in a client module and use the React hooks under <Bijection client>. A server-rendered value is one client.query in the request, on a client made for that request with the signed-in person’s token:
app/notes/page.tsx
Keep a server client scoped to its request: a client carries one identity. React Native and Expo. Use bijection/react as on the web. The client needs a streaming fetch and Temporal. Install a Temporal polyfill where the runtime has none. TanStack Query. A one-off read fits a query function. Throw on a refusal so TanStack Query reports it, and include every argument in the cache key:
For live values, use useWatch rather than polling.

Vue, Nuxt, Svelte and SvelteKit

There is no binding for these frameworks: use client.watch and stop it when the component goes away.
Note is FactOf<typeof items> from the app’s notes table, notes.items. In Nuxt and SvelteKit, make the client on the browser only, and server-render with a per-request client.query as for Next.js. Pass an auth adapter as token when people sign in; see Connect and authenticate.

Node.js, Bun and Deno

Close the client when the script is done, or the live connection keeps the process running.

A plain browser module

A page can load the client as an ES module through a tool that resolves package exports, such as the Vite dev server of the starter:
src/main.ts