1 comments

  • ndrean4 days ago
    I built ZeBridge to keep a local database on each device (SQLite, PGlite or DuckDB) in sync with a central PostgreSQL, for apps that must keep working on a bad connection.<p>It&#x27;s aimed at B2B operational apps (fleets, depots, field teams), where each customer organisation is a tenant. It isn&#x27;t built for consumer apps with one tenant per user.<p>How it works: a bridge written in Zig reads PostgreSQL&#x27;s logical replication and publishes changes to NATS JetStream, one stream per tenant. Clients seed from snapshots kept in the NATS object store, then follow the stream. Writes made offline wait in a local outbox. When the device reconnects they go to PostgreSQL, which applies your rules (functions, row-level security) and sends back a verdict for each one. PostgreSQL stays the authority; NATS only carries the data.<p>The same NATS connection also reaches your own services. The live demo uses this to ask a routing service for a truck&#x27;s route: <a href="https:&#x2F;&#x2F;bridge.zebridge.eu&#x2F;demo" rel="nofollow">https:&#x2F;&#x2F;bridge.zebridge.eu&#x2F;demo</a> (five trucks on a map of 16,173 charge points; open it in two tabs).<p>Clients: TypeScript (browser and Node), and a native Zig library with a C ABI, wrapped for Swift, Android, React Native, Flutter and Python.