Skip to content
In this postPostgreSQL

Electric Cloud is winding down. Here is where to run your sync

Electric joined Neon inside Databricks in August, and Electric Cloud is winding down with no published shutdown date. The sync engine stays open source. Here is what self-hosting it takes, and the Postgres checks to run before you move.

By Bob Bass4 min read
PostgreSQLDatabases

On August 11, Electric, the team behind PGlite and the Electric sync engine, joined the Neon team inside Databricks. Neon's post says PGlite went from 1 million to 13 million weekly downloads in a year, and most of the coverage focused on that number.

The line that matters more if you run Electric in production is in Electric's own announcement:

Electric Cloud is winding down. Cloud users will need to self-host or move to another provider. We've contacted every existing cloud user directly.

Three months later, as of November 20, no shutdown date, signup cutoff or data deletion date has been published. The Electric Cloud page still advertises a free tier. That ambiguity is the reason to move now: you get to choose when you migrate, instead of finding out from an email with a deadline.

What stays open source

Electric was clear on this point: "Everything Electric has previously open sourced stays open source: Postgres Sync, PGlite, TanStack DB, Durable Streams." The sync engine is Apache 2.0. What is going away is the hosted service, not the software, so leaving Electric Cloud means running the same sync service yourself.

What self-hosting Electric takes

Electric is a single service that sits between your Postgres and your clients. It reads changes from Postgres through logical replication and serves "shapes" (subsets of tables) to clients over HTTP. Electric's deployment guide lists what it needs:

  • Postgres 14 or newer, with logical replication enabled
  • A role with the REPLICATION attribute
  • A direct connection, not a pooler. Most poolers cannot carry a logical replication stream. You can optionally give Electric a second, pooled URL (ELECTRIC_POOLED_DATABASE_URL) for its ordinary queries.
  • A persistent disk for its shape cache
  • A host that runs a container. The image is electricsql/electric on Docker Hub, and the docs cover AWS, GCP, DigitalOcean, Fly.io and Render.

A minimal run looks like this:

bash
docker run -d --name electric \
  -e DATABASE_URL="postgresql://electric_user:secure_password@db-host:5432/app?sslmode=require" \
  -e ELECTRIC_SECRET="a-long-random-string" \
  -e ELECTRIC_STORAGE_DIR=/var/lib/electric \
  -e ELECTRIC_PORT=3000 \
  -v electric_data:/var/lib/electric \
  -p 3000:3000 \
  electricsql/electric

/v1/health answers without the secret, so you can point a load balancer health check at it. Electric also recommends putting a caching proxy or CDN in front of the service.

The database role

The permissions guide offers three setups. A superuser is the easiest and is recommended for development only. For production, create a dedicated role:

sql
CREATE ROLE electric_user WITH LOGIN PASSWORD 'secure_password' REPLICATION;
GRANT SELECT ON ALL TABLES IN SCHEMA public TO electric_user;

If that role also has CREATE on the database and owns the synced tables, Electric creates its publication and sets REPLICA IDENTITY FULL by itself. If you would rather not hand it table ownership, set ELECTRIC_MANUAL_TABLE_PUBLISHING=true. A DBA then creates the publication, adds the tables and transfers ownership of the publication:

sql
CREATE PUBLICATION electric_publication_default;
ALTER TABLE todos REPLICA IDENTITY FULL;
ALTER PUBLICATION electric_publication_default ADD TABLE todos;
ALTER PUBLICATION electric_publication_default OWNER TO electric_user;

Check your Postgres before you move

Every hosted Postgres configures replication differently, so run these on the database you plan to use before you deploy anything:

sql
SHOW wal_level;
SHOW max_replication_slots;
SELECT rolreplication FROM pg_roles WHERE rolname = current_user;

You want wal_level to be logical, at least one free replication slot, and rolreplication to be true for the role Electric connects as.

Postgres 19 changes the first check. If wal_level is replica, Postgres 19 raises it to logical by itself when the first logical replication slot is created, without a restart. On 19, SHOW effective_wal_level; tells you the level actually in use. On 18 and older, wal_level is still a restart-only setting, so find out whether your host lets you change it before you plan the cutover.

Cutting over from Electric Cloud

Most Electric Cloud users already own their Postgres. Electric Cloud ran the sync service against it, and Electric says Neon "powered the majority of Electric Cloud sync services." In that case you are moving only the sync layer:

  1. Deploy your own Electric against the same database, with its own replication stream. Set ELECTRIC_REPLICATION_STREAM_ID so its slot and publication names cannot collide with the ones Electric Cloud created.
  2. Point a staging build of your client at the new Electric URL and confirm your shapes load and update live.
  3. Switch the production client URL.
  4. Once Electric Cloud has disconnected, drop the slot it left behind. An inactive slot keeps holding WAL, and your disk fills slowly until it is gone.
sql
SELECT slot_name, active, pg_size_pretty(pg_wal_lsn_diff(pg_current_wal_lsn(), restart_lsn)) AS retained
FROM pg_replication_slots;

SELECT pg_drop_replication_slot('the_old_slot_name');

Electric's docs make the same point: when you stop using Electric on a database, drop both its publication and its slot. They also warn that the shape cache and the replication slot must stay in step. If you change DATABASE_URL or ELECTRIC_STORAGE_DIR later, clean up the other side too.

If you are moving the database as well

Some teams will use this as the moment to move the Postgres underneath too, especially if it was chosen because Electric Cloud recommended it. Layerbase Postgres gives every database a direct connection string next to the pooled one, and the direct string is the one to give Electric. PostgreSQL 19 is the default for new databases, so the automatic logical decoding described above applies. Run the three checks on your new database before pointing Electric at it, the same as you would on any host. Create a PostgreSQL database, or use the Cloud migration guide to import an existing one from Neon or Supabase.

If you are using PGlite rather than the sync service, nothing has been shut down. When an embedded prototype needs a real server, moving from PGlite to production Postgres is a dump and a restore.

Support chat