High-scale, hardened, drop-in real-time sync for Postgres.
PgVolt is an independent fork of
Electric, maintained by
Beeldi. It is not affiliated with or endorsed by
ElectricSQL.
"Electric" and "ElectricSQL" are the upstream project's names.
PgVolt is a drop-in replacement for upstream Electric (ELECTRIC_* configuration, /v1/shape HTTP
API, and upstream clients work unchanged), carrying performance, durability, correctness, and
security improvements without waiting on upstream to take them.
Upstream Electric slows down when shape counts climb into the tens or hundreds of thousands, or when
bursty writes fan out across many tenants at once: replication slots lag behind Postgres, restarts
spike RAM and stall on cold disks, and rolling deploys hang on active long-polls. PgVolt removes
those bottlenecks while staying drop-in compatible (synthetic benchmarks vs upstream Electric 1.8.0
6efc8a7d3):
| What improves | Upstream | PgVolt | Why it matters |
|---|---|---|---|
| WAL slot catch-up in write storms (opt-in) | 49.5 s | 6-8 s (6-8x) | Keeps Postgres WAL from growing during bursty writes |
| Multi-tenant filter routing (20k shapes) | 23.3 ms | 6.0 µs (~3,800x) | Removes linear IN + OR and && scans that stall WAL drain |
| Wide-transaction fan-out (8k shapes / txn) | 4.2 s | 17 ms (~247x) | Eliminates quadratic collector waits when many shapes match |
| Boot catalog fold RAM (4k shapes) | 489.3 MB | 2.9 MB (168x less) | Prevents boot OOMs as stored shape counts grow |
| Shape catalog size & cold open (100k shapes) | 2.3 GiB / 1x | 568 MiB / >10x | Cuts catalog disk 4x and slashes cold-cache restart time |
| Graceful shutdown under live load (200 clients) | 14 min (849 s) | 1.1 s (~770x) | Stops rolling deploys from hanging on open long-poll streams |
Also included: 12.5x faster filter index rebuilds (146.4 s to 11.7 s at 40k shapes),
>3x faster multi-core boot restore, 4x fewer Postgres round trips per snapshot (8 to 2),
64% less router memory per filter clause, 5.7x lower WAL lag under concurrent live clients
(opt-in), and zero-resync Postgres replica failovers (ELECTRIC_KEEP_SHAPES_ON_PROMOTION). See
fork/CHANGES.md for all 19 synthetic benchmarks and the 10
opt-in switches.
- Correctness & formal verification:
121fixes across Postgres where-clause and subquery parity, crash-safe storage and compaction, and restart recovery, backed by162added test files and TLC-checked TLA+ formal verification (fork/tla). - Security & hardening:
25+fixes and defaults, including constant-time Bearer auth,sslmode=verify-ca/verify-full, cache-keyVaryisolation, SHA-256 handle digests, credential redaction, bounded query/response/memory limits, and a non-root distrolesscc-debian12release image. - Drop-in compatibility: All
10high-scale/failover switches and7experimental HTTP API additions are off by default and tested both off and on in CI.
PgVolt maintains the sync service, its telemetry package, and the TypeScript and Elixir clients. Maintenance is best effort and there is no feature roadmap.
- Scope. The fork drops the upstream code outside its scope: the website, the examples, the agents and other packages, and their workflows and scripts. fork/removed-upstream-paths lists every path.
- Differences. fork/CHANGES.md lists what behaves differently from upstream, what to check before switching in either direction, and the fixes by area.
- Docs. Upstream's documentation at electric-sql.com/docs describes the service. The pages this fork has edited are mirrored from upstream's VitePress sources under fork/docs: the configuration reference lists the options the fork adds.
- Additions to the HTTP API. Each one is opt-in and experimental, and is described in the sync service README: subset snapshot row cap, full transaction provenance, live-request multiplexing, locale-projected columns, covered LSN wait, shape generation reclaim, and read-only health probes.
- Changes. Each change ships with a note in .changeset.
mainis the default branch for development and upstream integration.feature/*branches are temporary. Targetmainand delete the branch after merging.release/<version>is cut from a released commit when a release needs a fix thatmaincannot take. CI already runs onrelease/**.
When upstream publishes changes, run git fetch upstream --tags, then
scripts/merge_upstream.sh <ref> with a release tag such as @core/sync-service@1.8.1, or
upstream/main. The script merges without committing, removes the listed paths again,
regenerates the lockfile once no conflict is left, and prints what needs a person: conflicts,
new upstream paths, and changesets for removed packages. A new upstream path the fork does not
need joins the list in the merge commit.
Table of Contents:
- Why PgVolt?
- About this fork
- What is Electric?
- Getting Started
- HTTP API Docs
- Phoenix LiveDashboard
- Developing Electric
- Contributing
- Support
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.
See the Quickstart guide to get up and running. In short, you need to:
- have a Postgres database with logical replication enabled; and then to
- run Electric in front of it, connected via
DATABASE_URL
For example, using Docker Compose from the root of this repo. --build builds the sync service from this checkout; without it Compose pulls upstream's image:
docker compose -f .support/docker-compose.yml up --buildYou can then use the HTTP API to sync data from your Postgres. For example, to start syncing the whole foo table:
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:
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.
The HTTP API is defined in an OpenAPI spec in upstream's website/electric-api.yaml.
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=4000The dashboard will be available at http://localhost:4000 (or whichever port you choose). When the variable is not set, the dashboard is not started.
In this fork the dashboard listens on loopback only, 127.0.0.1 or ::1 with ELECTRIC_LISTEN_ON_IPV6=true. Set ELECTRIC_LIVE_DASHBOARD_ADDRESS, for example to 0.0.0.0, to reach it from another host.
WARNING: The LiveDashboard endpoint is completely unauthenticated. Anyone with network access to the port can view internal system state. Before listening on another address, you must restrict access to this port using firewall rules, network policies, or similar controls. Do not expose it to the public internet.
We use asdf to install Elixir, Erlang, and Node.js. Versions are defined in .tool-versions.
brew install asdf
asdf plugin add nodejs
asdf plugin add pnpm
asdf plugin add elixir
asdf plugin add erlang
asdf installYou'll probably need to fiddle with your bash/zsh/etc rc file to load the right tool into your environment.
Electric has comprehensive test suites for both Elixir and TypeScript components.
Install dependencies (if not already done):
asdf install
pnpm installThen start the test Postgres database:
cd packages/sync-service
mix start_devThis starts a Docker Compose setup with Postgres configured for logical replication on port 54321.
To stop the database:
mix stop_devSync Service:
cd packages/sync-service
mix testFor coverage reports:
mix coveralls.htmlElixir Client:
cd packages/elixir-client
mix testTypeScript tests require both the database and a running sync service.
In a separate terminal, start the sync service:
cd packages/sync-service
iex -S mixThen run the tests:
cd packages/typescript-client
pnpm testFor coverage:
cd packages/typescript-client
pnpm coverageSee the:
Open an issue in this repository for bugs in the fork. Questions about Electric in general are better served by upstream's documentation and community.