Sync engine

Live queries over WebSocket.

db.useQuery is a WebSocket subscription. Pylon walks the change log on every write and pushes the exact diff to each subscribed client, keeping the UI current without polling or cache invalidation.

components/Messages.tsx
import { db } from "@pylonsync/react";
function Messages({ roomId }: { roomId: string }) {
// A live subscription. Re-renders the instant anyone,
// anywhere, inserts or edits a matching Message row.
const { data: messages } = db.useQuery<Message>("Message", {
where: { roomId },
});
return messages.map((m) => <Bubble key={m.id} message={m} />);
}
  • Subscriptions update in milliseconds because the server pushes diffs instead of waiting for clients to poll
  • Local-first: reads hit an in-browser store, writes apply optimistically and reconcile
  • Queue mutations offline and sync them when the connection returns
  • Multi-tab coherent via a leader election over BroadcastChannel

How it works.

orders · subscribed
db.useQuery("Order")live
ord_9f2aSarah Chen$1,240
ord_7c41Marcus Lee$880
ord_5b88Priya Nair$2,100
ord_3d10Elena Duarte$640
diff streamed to 44 clients

On every write, Pylon walks an append-only change log and finds the affected subscriptions. Clients receive a minimal insert, update, or tombstone instead of fetching the result again. A 10,000-row table therefore updates as cheaply as a 10-row one.

What you’d otherwise wire up.

Each line is a piece teams normally assemble for this one capability. On Pylon it is part of the runtime.

  • A WebSocket server, plus reconnect and backoff logic
  • A client cache and the invalidation rules that keep it honest
  • Optimistic update plumbing and its rollback path
  • A polling loop, or an SSE fallback for browsers that drop the socket

Apps built with it.

Scaffold any of these with npm create @pylonsync/pylon.

All examples →
liveMarketplace

A trading marketplace deployed from a monorepo, with listings, watchlists, an activity feed, faceted search, and per-user ownership.

Faceted searchfield.owner()Optimistic inserts
template: marketplaceOpen
liveWorld3D

A multiplayer procedural island with three.js in the browser and Pylon SSR and realtime sync on the server. Every visitor moves through the same world.

Realtime multiplayerthree.js + SSRLive sync
Consumer app

A social feed with live posts and likes, public reads, and owner-only writes.

Live feedPublic readsfield.owner()
template: consumer

Build it on Pylon.

One framework for your schema, sync, auth, functions, realtime, and SSR. Free to start.