hn.today

ZeBridge – PostgreSQL replicas on devices, synchronized over NATS

github.com3 points0 comments
Screenshot of ZeBridge – PostgreSQL replicas on devices, synchronized over NATS

ZeBridge is a local-first synchronization system that gives each device a database replica and connects those replicas to PostgreSQL through NATS. Apps can read locally and keep working offline; mutations wait in a local outbox until connectivity returns. PostgreSQL remains authoritative: its rules decide whether writes are accepted and resolve conflicts, rather than trusting device replicas as the final record. Clients can use SQLite, PGlite, PostgreSQL, or DuckDB, and can query optional services such as routing or analytics over the same NATS connection. The project is aimed chiefly at B2B operational software in which a tenant’s devices share working data - for example, teams in fleets, depots, or field sites - not consumer apps with one tenant per user.

Deployment combines NATS, the bridge, a mutation-admission service, and a cleanup process, with PostgreSQL hosted locally or elsewhere. An application backend handles user authentication and requests a one-time invite from PostgreSQL; the client uses it to enroll a device and obtain scoped credentials. The included Docker evaluation demonstrates tenant isolation, public data shared across tenants, foreign-key checks, rejected writes, and collaborative editing. When services stop, devices can continue reading and queueing changes; after reconnection, they submit pending writes and catch up. The counter example uses last-writer-wins, so competing offline clicks do not add together. A live fleet demo illustrates shared device state and local queries alongside remote routing.

Read on github.com0 comments on Hacker News

Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.

More in Programming

The daily digest

Today's best Hacker News stories, summarized and screenshotted, one email a day.