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 VIEW | synctable | |
|---|---|---|
| Partial refresh | Full refresh only | Per-key incremental |
| Column-level gate | No | IS DISTINCT FROM watched cols |
| CDC / outbox | No | Transactional outbox + NOTIFY |
| MV on MV | Not composition-safe | DAG with cycle detection |
| Local-first client | No | Dexie + 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