Skip to content
An elephant with vast ears flying through a storm, lightning arcing from its trunk

pgxsinkit

Opinionated, Offline-first, RLS-aware sync between PostgreSQL/Supabase and Drizzle/pgwasm at the edge.

pgxsinkit is the @pgxsinkit/* library set. It gives a local-first app a read path that streams Postgres rows to the local store (pgwasm, Postgres in WebAssembly) through the Circuits engine and durable-streams, and a write path that takes local edits back to Postgres through a typed write route — with per-row access control on both (Postgres row-level security on writes, a matching shape predicate on reads).

Read path

PostgreSQL -> Circuits engine -> durable-streams -> pgwasm. Shapes (including membership fan-out via an uncorrelated subquery predicate) stream into the local pgwasm store. A control plane grants a subject its subscriptions, and a stream edge gates every read against that grant.

Write path

client -> write route -> PostgreSQL. Edits are staged locally, flushed as a batch, and applied in a single in-database PL/pgSQL function — one path, no per-table CRUD.

Tested against real infrastructure

A container-backed integration + performance harness runs every path against real PostgreSQL, the Circuits engine, durable-streams, and pgwasm — not mocks — so the toolkit’s behaviour is proven, not asserted.