graph TD
A[客户端请求] --> B[接入层]
B --> C{"参数校验"}
C -->|"通过"| D[核心代理]
C -->|"失败"| E[错误处理]
D --> F{"数据一致性检查"}
F -->|"一致"| G[数据同步器]
F -->|"不一致"| H[异常处理]
G --> I("同步完成")
H --> J("回滚操作")
Sync is the magic ingredient behind fast, modern software. From apps like Figma and Linear to AI agents running on live local data.
Electric is a Postgres sync engine. It solves the hard problems of sync for you, including partial replication, fan-out, and data delivery. So you can build awesome software, without rolling your own sync.
Specifically, Electric is a read-path sync engine for Postgres. It syncs data out of Postgres into … anything you like. The core sync protocol is based on a low-level HTTP API. This integrates with CDNs for highly-scalable data delivery.
Electric includes an optional Phoenix LiveDashboard for real-time monitoring of the running system (VM metrics, process info, ETS tables, etc.).
To enable it, set the ELECTRIC_LIVE_DASHBOARD_PORT environment variable:
ELECTRIC_LIVE_DASHBOARD_PORT=4000
The dashboard will be available at http://localhost:4000 (or whichever port you choose). When the variable is not set, the dashboard is not started.
WARNING: The LiveDashboard endpoint is completely unauthenticated. Anyone with network access to the port can view internal system state. In production, you must restrict access to this port using firewall rules, network policies, or similar controls. Do not expose it to the public internet.
Developing Electric
We use asdf to install Elixir, Erlang, and Node.js. Versions are defined in .tool-versions.
评论