Skip to content
ElectricElectric
PricingBlog
Main Navigation
Go to Cloud
Cloud
Go to Cloud
Are you an LLM? You can read better optimized documentation at /sync.md for this page in Markdown format

Electric Sync

Composable sync primitives for multi-agent systems

QuickstartDocs

Compose your sync stack

Three composable primitives that work together — or independently — to keep state in sync from your database, through your network, into your apps and agents.

Postgres Sync

Postgres Sync

Sync from your database into your apps.

With partial replication, data delivery and fan-out.

TanStack DB

TanStack DB

Reactive client store for super-fast apps.

For sub-millisecond reactivity and instant writes.

PGlite

PGlite

Embeddable Postgres with reactivity and sync.

A full database inside your client or runtime.

Postgres Sync

Sync subsets of your Postgres into everything. A read-path sync engine that streams shapes from Postgres over plain HTTP. Cached at the edge, fanned out to millions of concurrent readers, with flat database load.

Define a shape on the server. Mount a collection on the client. Render a live query. Writes go through your existing backend.

Explore Postgres SyncDocs
Postgres
shape: events
tx 000
WebWeb / Mobilereact
Mobileexpo
Agenthandler

TanStack DB

A reactive client store for building super-fast apps. Sub-millisecond reactivity, instant local writes, and live cross-collection queries powered by differential dataflow.

Loads data from any source — including Postgres Sync and Electric Streams — with optimistic mutations that reconcile against your backend.

Explore TanStack DBTanStack DB docs
app/Todos.tsx
const todos = createCollection(
  electricCollectionOptions({
    shapeOptions: { url: "/api/todos" },
    getKey: (row) => row.id,
  }),
)

export function Todos() {
  const { data } = useLiveQuery((q) =>
    q.from({ todo: todos })
     .where(({ todo }) =>
        eq(todo.completed, false)),
  )
  return <List todos={data} />
}
  1. 1
    Electric collection. Subscribes to a server-defined shape. Synced rows live locally — persisted, reactive, and shared across every component that queries them.
  2. 2
    Live incremental reactivity. Differential dataflow keeps the result set up to date as rows arrive or change — sub-millisecond updates, only the diff re-renders.

PGlite

Embeddable Postgres with reactivity and sync. A lightweight WASM build of Postgres — under 3MB gzipped — that runs in the browser, Node.js, Bun and Deno, with built-in live query and sync primitives.

Pair it with Postgres Sync to keep an embedded Postgres database in sync with your cloud Postgres — for fully local, offline-capable apps.

Explore PGlitePGlite.dev
PGlite REPLWASM Postgres · in this page
Booting PGlite…

Sync is how humans stay in the agent loop

Agents work on shared data — and they change it while users are still looking at it. Without sync, your UI shows stale state, users have to refresh, and teams lose track of what each agent is doing.

With Electric, every user, device, and teammate sees agent changes in real time. The same shared state powers multi-tab, multi-device, multi-user, and multi-agent collaboration — out of the box.

Read: the data primitive for the agent loop →
userdeviceuserdeviceuserdevice
shared
state
agentagentagentagentagent

The best way to build apps

Sync makes your apps super-fast, with end-to-end reactivity, resilience, and built-in multi-user collaboration.

01

Super-fast reactivity

Build fast, modern apps like Figma and Linear. Sub-millisecond reactivity and instant local writes.

Read more →
02

Resilient transport

Build apps that work reliably, even with patchy connectivity. Resilient transport that ensures data is never lost.

Read more →
03

Real-time collaboration

Build multi-user, multi-agent apps that naturally support both real-time and asynchronous collaboration.

Read more →
04

Durable state

Build multi-step agentic workflows that survive crashes and restarts. Agents and workers resume from the same durable state.

Read more →
Postgres Sync  +  TanStack DB

Your first sync, end to end

Compose Postgres Sync with TanStack DB to ship a real-time feature in three moves: define a shape on the server, mount a collection on the client, render a live query.

api/todos.ts  — server proxy
export const ServerRoute = createServerFileRoute("/api/todos").methods({
  GET: async ({ request }) => {
    const url = new URL(request.url)
    const origin = new URL("https://api.electric-sql.cloud/v1/shape")
    url.searchParams.forEach((v, k) =>
      ELECTRIC_PROTOCOL_QUERY_PARAMS.includes(k) &&
        origin.searchParams.set(k, v))

    origin.searchParams.set("table", "todos")
    origin.searchParams.set("where", "user_id = $1")
    origin.searchParams.set("params", JSON.stringify([user.id]))

    return fetch(origin)
  },
})
app/Todos.tsx  — client
export const todoCollection = createCollection(
  electricCollectionOptions({
    id: "todos",
    shapeOptions: { url: "/api/todos" },
    getKey: (row) => row.id,
  }),
)

export function Todos() {
  const { data } = useLiveQuery((q) =>
    q.from({ todo: todoCollection })
     .where(({ todo }) => eq(todo.completed, false)),
  )
  return <List todos={data} />
}
  1. 1
    Server-side proxy.

    Forward the request to your Electric instance. Keep the source secret on the server.

  2. 2
    Pin the table.

    The shape is defined server-side, not by the client. The client can't ask for tables it shouldn't see.

  3. 3
    Tenant isolation.

    Bind the where clause to the authenticated user — every client gets its own slice.

  4. 4
    It's just HTTP.

    Shapes stream over plain HTTP. Cache, log and rate-limit them with the middleware you already use.

  5. 5
    Mount a collection.

    An Electric collection in TanStack DB — local, reactive, persisted.

  6. 6
    Render a live query.

    Sub-millisecond reactivity over the local data. Updates flow in as the shape changes.

QuickstartRead the Docs

Demos

Reference apps you can clone, run locally, and learn from.

Burn

Burn

Agentic system built on Postgres and a real-time sync stack.

AI Chat

AI Chat

Resilient, multi-user, multi-agent AI chat app powered by Electric.

Linearlite

Linearlite

Local-first project management app built with Electric and PGlite.

From the blog

Deep dives into sync engine architecture, the agent loop, and building real apps on the stack.

Durable Streams — the data primitive for the agent loop

Read post →

Super-fast apps on sync with Electric and TanStack DB

Read post →

Electric apps get persistence and includes with TanStack DB 0.6

Read post →

Local-first with your existing API

Read post →
Electric Blog
Open source · Apache 2.0 · ★ 9.5k

Start syncing in minutes

Spin up the starter, point it at Postgres, and ship a real-time app on top of your existing stack.

QuickstartDocsGitHub

ElectricElectric

AboutContactLegalDocsDemosBlogSign up
TanStack DBPGliteXBlueskyDiscordGitHub

© 2026 Electric DB Inc. Released under the Apache 2.0 License.

✨ Markdown