~/tools/electric
tool

Electric

Electric is an open source Postgres sync engine you can self-host — it streams subsets of your Postgres database into web and mobile apps in real time over plain HTTP, so local state stays live without you building your own WebSocket and caching layer.

What is Electric?

Electric is a Postgres sync engine that streams live data from your database into local apps and services in real time. It sits in front of Postgres, watches for changes using logical replication, and delivers matching rows to clients over plain HTTP and JSON — so your UI always reflects the current database without you writing custom WebSocket or polling code.

What is Electric best for?

Electric is best for teams building real-time and local-first apps on top of an existing Postgres database — live dashboards, collaborative UIs, and offline-capable clients. It fits when you already own your backend and API and just want the read path (Postgres → client) to stay in sync, without adopting a proprietary realtime platform.

What can Electric do?

  • Sync selective subsets of Postgres to clients using Shapes — a query-like way to define exactly which rows each client gets
  • Deliver updates over standard HTTP and JSON, so any language or framework that speaks HTTP can consume it
  • Scale to large numbers of concurrent clients by caching shape responses on a CDN, keeping load off the database
  • Ship official client libraries and framework integrations, including a React useShape hook and a TanStack DB binding
  • Run entirely on your own infrastructure with Docker Compose, connected to Postgres via a DATABASE_URL
  • Monitor the sync service with a built-in Phoenix LiveDashboard

Where does Electric fall short?

  • Read-path only. Electric syncs data out of Postgres to clients, but it does not handle writes back to the database — you bring your own API or mutation path to get local changes into Postgres.
  • Shapes are single-table. A shape reads from one table with a where-clause filter; there are no cross-table JOINs, so multi-table views take multiple shapes or subqueries.
  • Postgres-only. Electric requires Postgres with logical replication enabled. If you run MySQL, MongoDB, or another database, it is not an option.

Is Electric free?

Yes — Electric is fully open source under the Apache 2.0 license, and self-hosting is free; you only pay for the server and Postgres it runs on. Electric Cloud is a separate managed offering with usage-based pricing for teams that would rather not run the sync service and CDN themselves.

What does Electric replace?

Electric is a self-hosted alternative to hosted realtime and backend platforms like Firebase, Ably, and Pusher. Instead of codifying access rules into a proprietary realtime database or paying per message and per connection, you keep your own Postgres and API and let Electric handle streaming live data to clients over HTTP.

FAQ

Is Electric open source? Yes. Electric is licensed under Apache 2.0, an OSI-approved permissive license, and the full sync engine is on GitHub. The managed Electric Cloud is a separate paid product.

Can I self-host Electric for free? Yes. You run the Electric sync service (via Docker Compose) in front of your own Postgres, and pay only for that infrastructure. There is no license fee for the open source engine.

Is Electric a good Firebase alternative? For the realtime read path, yes — it keeps clients in sync with live data while letting you own your Postgres, API, and auth. Unlike Firebase, it does not bundle authentication, storage, or a write API, so you provide those yourself.

What do I need to run Electric? A Postgres database with logical replication enabled, the Electric sync service (typically via Docker), and a client library or plain HTTP requests to consume shapes. Adding a CDN in front is optional but recommended for scale.