About this project
Electric is an open-source sync engine for Postgres, described as real-time sync for Postgres and positioned as a foundation for fast, modern software and AI agents running on live local data. It focuses on the read path: syncing data out of Postgres into arbitrary consumers rather than writing back into the database.
The project addresses common sync problems such as partial replication, fan-out and data delivery, so developers do not have to build their own sync layer. The core sync protocol is exposed as a low-level HTTP API, which the documentation notes can integrate with CDNs for scalable data delivery.
Partial replication is configured using Shapes, which define what subset of data is synced. Consumers can use the HTTP API directly or work through client libraries and framework integrations, including a TypeScript client and a React hook called useShape. An Elixir client package is also present in the repository.
Getting started requires a Postgres database with logical replication enabled, then running Electric in front of it connected via a DATABASE_URL. The README shows a Docker Compose command from the repository root to bring up the stack, followed by a curl request to the /v1/shape endpoint to begin syncing a table, and a short React example using useShape with table and where parameters.
The HTTP API is defined in an OpenAPI specification stored in the repository. Electric also includes an optional Phoenix LiveDashboard for real-time monitoring of VM metrics, process information and ETS tables, enabled by setting an environment variable for the dashboard port. The README explicitly warns that this dashboard endpoint is unauthenticated and must be restricted in production.
Development uses asdf to manage Elixir, Erlang and Node.js versions, with setup instructions for macOS. The repository contains test suites for both Elixir and TypeScript components, with prerequisites including a Docker Compose Postgres configured for logical replication. Commands are documented for running Elixir sync service and client tests, TypeScript package tests, and coverage reports. The project is licensed under Apache 2.0 and offers a community Discord for support.
Comments
0 Rating appears after 10 ratings
Sign in to join the discussion.