Docs

synctable lets you define a composite model over Postgres source tables and get a server-maintained materialized view, a typed React hook, real-time delivery, and local-first sync—generated, committed to VCS, and ready in one step.

Why not MATERIALIZED VIEW?

Postgres MATERIALIZED VIEWs are powerful but limited: they refresh wholesale even when one row changes, they cannot react to field-level changes, and they cannot drive a CDC pipeline. synctable targets are regular tables that update incrementally with field-level change gating, emit ordered outbox events for subscribers, and compose into a DAG without stale reads.

MATERIALIZED VIEWsynctable
Partial refreshFull refresh onlyPer-key incremental
Column-level gateNoIS DISTINCT FROM watched cols
CDC / outboxNoTransactional outbox + NOTIFY
MV on MVNot composition-safeDAG with cycle detection
Local-first clientNoDexie + Zustand + hint-then-fetch

Quick start

git clone https://github.com/ray/synctable
cd synctable
pnpm install
pnpm migrate    # installs synctable engine in Postgres
pnpm test       # runs pgTAP + Vitest suites