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/PGlite at the edge.

pgxsinkit is the @pgxsinkit/* library set. It gives a local-first app a read path that streams Postgres rows to PGlite through ElectricSQL, 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 filter on reads).

Read path

PostgreSQL -> ElectricSQL -> PGlite. Shapes (including membership fan-out via subquery where) stream into local PGlite. Reads never hit Electric directly — they go through the shape proxy, which enforces ownership.

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, ElectricSQL, and PGlite — not mocks — so the toolkit’s behaviour is proven, not asserted.