An open source read-path sync engine that streams subsets of a Postgres database live into apps, services and agents
open sourceApache-2.0self-hostablefree
Electric's Postgres Sync (formerly called Electric, or the Electric sync engine) syncs subsets of a Postgres database, called shapes and defined like SQL queries, out to web, mobile and desktop apps, server workers and agents, and keeps them live. It reads Postgres's logical replication stream, fans changes out over plain HTTP and JSON, which a CDN can cache, and delivers the same ordered log to every subscriber. Writes go through your own API. It runs as a separate Elixir service from a Docker image in front of any Postgres with logical replication, with TypeScript and Elixir clients and integrations for PGlite and TanStack DB.
Problems it solves
- keep my web app's data in sync with Postgres in real time without writing websocket code
- sync just the rows each user is allowed to see from Postgres into a local-first app
- stream live Postgres changes to many clients without overloading the database
Features
- Partial replication of Postgres through shapes
- Live fan-out over plain HTTP, cacheable by a CDN
- Same ordered log to every subscriber
- TypeScript and Elixir clients
- Integrations with TanStack DB and PGlite
- Runs from a Docker image in front of any Postgres with logical replication
Limitations
- Needs a Postgres with logical replication enabled and a database user with the REPLICATION role1
- Handles only the read path: writes go through your own API or backend2
Capabilities
| Has an API | plan not known |
|---|---|
| Has official SDKs | plan not known |
Alternatives
The same job
These do what Electric Postgres Sync does.
- Convex The reactive backend platform that keeps up with you and your agents
- SurrealDB A multi-model database built in Rust that unifies document, graph, relational, time-series, geospatial and key-value data
- InstantDB An open-source realtime backend with relational queries, auth, permissions, storage and presence