Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
E

electric

> 数据库
Open source

The agent platform built on sync.

10.3K stars0 likes0 views
WebsiteGitHub

About

The agent platform built on sync.

</picture>

Electric

Real-time sync for Postgres.

Table of Contents:

  • Quick links
  • What is Electric?
  • Getting Started
  • HTTP API Docs
  • Phoenix LiveDashboard
  • Developing Electric
    • Mac setup
  • Contributing
  • Support

Quick links

  • Quickstart
  • Website
  • About
  • Docs
  • Demos (also see the ./examples folder)

What is Electric?

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.

Partial replication is managed using Shapes. Sync can be consumed directly or via client libraries and framework integrations.

Getting Started

See the Quickstart guide to get up and running. In short, you need to:

  1. have a Postgres database with logical replication enabled; and then to
  2. run Electric in front of it, connected via DATABASE_URL

For example, using Docker Compose from the root of this repo:

bash
docker compose -f .support/docker-compose.yml up

You can then use the HTTP API to sync data from your Postgres. For example, to start syncing the whole foo table:

bash
curl -i 'http://localhost:3000/v1/shape?table=foo&offset=-1'

Or use one of the clients or integrations, such as the useShape React hook:

javascript
import { useShape } from '@electric-sql/react'

function Component() {
  const { data } = useShape({
    url: `http://localhost:3000/v1/shape`,
    params: {
      table: `foo`,
      where: `title LIKE 'foo%'`,
    },
  })

  return JSON.stringify(data)
}

Again, see the Quickstart and the Docs for more details.

HTTP API Docs

The HTTP API is defined in an OpenAPI spec in website/electric-api.yaml.

Phoenix LiveDashboard

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:

bash
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.

Mac setup

bash
brew install asdf
asdf plugin add nodejs
asdf plugin add pnpm
asdf plugin add elixir
asdf plugin add erlang
asdf install

You'll probably need to fiddle with your bash/zsh/etc rc file to load the right tool into your environment.

Running Tests

Electric has comprehensive test suites for both Elixir and TypeScript components.

Prerequisites

Install dependencies (if not already done):

bash
asdf install
pnpm install

Then start the test Postgres database:

bash
cd packages/sync-service
mix start_dev

This starts a Docker Compose setup with Postgres configured for logical replication on port 54321.

To stop the database:

bash
mix stop_dev

Elixir Tests

Sync Service:

bash
cd packages/sync-service
mix test

For coverage reports:

bash
mix coveralls.html

Elixir Client:

bash
cd packages/elixir-client
mix test

TypeScript Tests

TypeScript tests require both the database and a running sync service.

In a separate terminal, start the sync service:

bash
cd packages/sync-service
iex -S mix

Then run the tests:

Individual Package:

bash
cd packages/typescript-client  # or any other TS package
pnpm test

All TypeScript Packages:

From the root directory:

bash
pnpm -r test

For coverage:

bash
pnpm coverage

Contributing

See the:

  • Guide to Contributing
  • Contributor License Agreement
  • Community Guidelines

Support

We have an open community Discord. Come and say hello and let us know if you have any questions or need any help getting things running.

It's also super helpful if you leave the project a star here at the top of the page☝️

Issues· 264 open

View all issuesOpen on GitHub
  • #4806

    TypeScript client: SSE up-to-date offset `${lsn}_0` regresses behind header `electric-offset` when the LSN carries multiple ops, causing an immediate-replay loop

    Updated Sep 15, 2026
  • #4802

    agents-runtime: background compaction stays running after normal idle exit

    Updated Sep 12, 2026
  • #4466

    Evaluate Agents docs and tutorials for 0.1

    Updated Aug 28, 2026
  • #4783

    Remove the client's replay-mode / UpToDateTracker mechanism

    Updated Aug 28, 2026
  • #4788

    Non-blocking writer barrier for publication table additions

    Updated Aug 28, 2026
  • #4749

    Allow AgentsHost to be constructed from a caller-owned PgClient without a schema-bound DrizzleDB

    electric-agentsUpdated Aug 26, 2026
  • #4746

    Allow `runMigrations` to accept a caller-owned PostgreSQL client

    electric-agentsUpdated Aug 26, 2026
  • #4772

    AdmissionControl permits leak when HTTP/2 stream processes terminate with their connection

    Updated Aug 25, 2026
  • #4770

    [Discussion] Future of Electric after Databricks?

    Updated Aug 24, 2026
  • #4743

    `add_shape` is O(node population) for unindexed clauses: the whole `other_shapes` map is copied in and out of ETS per insert

    Updated Aug 23, 2026

> Tags

TypeScriptagentagentscrdtcrdts

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 29, 2026
Category数据库
PricingOpen source

> Related tools

P
PostgreSQL
功能强大的开源关系型数据库
R
Redis
内存数据结构存储,常用作缓存与队列
M
MySQL
广泛使用的开源关系型数据库