
Self-hosting ElectricSQL the easy way
Yulei ChenElectricSQL is an open-source sync engine that streams shape-based subsets of your Postgres data to clients over HTTP. It's a great fit for local-first apps, real-time dashboards, and anything that needs a reactive view of a Postgres table without writing your own change data capture pipeline. Running it as a managed service is possible, but most teams want full control over their data and the ability to self-host next to their own database.
Sliplane is a managed container platform that makes self-hosting painless. With one-click deployment, you can get an ElectricSQL sync service up and running in minutes, no reverse proxy config, no server to maintain, no Kubernetes.
Prerequisites
Before deploying, ensure you have a Sliplane account (free trial available).
You also need a Postgres database with logical replication enabled (wal_level = logical). ElectricSQL does not ship Postgres itself, you point it at your existing database. If you don't have one yet, take a look at our guide on 5 cheap ways to host Postgres or spin one up with the Sliplane Postgres preset and enable logical replication on it.
Quick start
Sliplane provides one-click deployment with presets.
- Click the deploy button above
- Select a project
- Select a server. If you just signed up you get a 48-hour free trial server
- Click Deploy!
Once the service is up, plug in your DATABASE_URL in the service settings and redeploy. That's it.
About the preset
The one-click deploy above uses Sliplane's ElectricSQL preset. The preset is built for a stable, minimal default setup:
- Official
electricsql/electricimage - Specific version tag for stability (check Docker Hub for newer versions when you're ready to upgrade)
- Persistent storage mounted to
/app/persistentso shape state survives restarts - HTTP service with healthcheck on
/v1/health - Secret-protected sync endpoint via a randomly generated
ELECTRIC_SECRET - Usage reporting disabled by default
The preset does not deploy Postgres for you. You have to provide a DATABASE_URL pointing at a Postgres instance with logical replication turned on. This matches the official Coolify template and the ElectricSQL deployment guide.
Next steps
Once ElectricSQL is running on Sliplane, access it at the domain Sliplane provided (e.g. electricsql-xxxx.sliplane.app). Hit /v1/health to confirm it's alive.
Point ElectricSQL at your Postgres
Open the service on Sliplane, go to the Envs tab, and set DATABASE_URL to your Postgres connection string. It should look like this:
postgresql://user:password@your-db-host:5432/yourdb?sslmode=require
Postgres must have wal_level = logical (most managed Postgres providers support this with a flag or parameter). ElectricSQL uses logical replication to stream changes, so without it the service will fail to start. The Electric deployment guide has provider-specific notes.
After changing DATABASE_URL, redeploy the service.
Authenticating shape requests
The preset generates a random ELECTRIC_SECRET for you. To fetch a shape, your backend or proxy must append this secret to requests:
GET https://electricsql-xxxx.sliplane.app/v1/shape?table=items&secret=<ELECTRIC_SECRET>
Never expose the secret to clients directly. The recommended pattern is to front ElectricSQL with your own API and inject the secret server-side. See the Electric security docs for details.
Key environment variables
| Variable | What it does |
|---|---|
DATABASE_URL | Postgres connection string (required) |
ELECTRIC_SECRET | Shared secret required on all shape requests |
ELECTRIC_STORAGE_DIR | Where shape state is stored on disk (preset: /app/persistent) |
ELECTRIC_USAGE_REPORTING | Set to false to disable anonymous usage telemetry |
ElectricSQL also supports a bunch of tuning knobs (connection pool size, log level, cache sizes). Check the configuration reference if you need to tweak behavior.
Logging
By default, Docker container logs go to STDOUT, which works out of the box with Sliplane's built-in log viewer. For tips on reading Docker logs, see our post on how to use Docker logs.
Troubleshooting
If the service refuses to start, check the logs for one of these usual suspects:
wal_levelnot set tological: Fix this on your Postgres instance and restart it.- Permissions: The Postgres user in
DATABASE_URLneedsREPLICATIONprivileges. - SSL mismatch: Managed Postgres providers usually require
sslmode=require.
Cost comparison
You can of course host ElectricSQL on other providers too. Here is how they stack up for a small sync service:
| Provider | vCPU Cores | RAM | Disk | Estimated Monthly Cost | Notes |
|---|---|---|---|---|---|
| Sliplane | 2 | 2 GB | 40 GB | €9 | charge per server |
| Render | 1 | 2 GB | 40 GB | ~$35-$45 | VM Small |
| Fly.io | 2 | 2 GB | 40 GB | ~$20-$25 | VM + volume |
| Railway | 2 | 2 GB | 40 GB | ~$15-$66 | Usage-based |
FAQ
Do I need to deploy Postgres separately?
Yes. ElectricSQL is a sync engine, not a database. You point it at an existing Postgres instance with logical replication enabled. You can deploy Postgres on Sliplane too with the Postgres preset, or use any managed provider, check out 5 cheap ways to host Postgres for ideas.
How do I enable logical replication on my Postgres?
Set wal_level = logical in postgresql.conf (or via your provider's parameter groups) and restart. The Postgres user in DATABASE_URL also needs the REPLICATION role. Our post on best practices for Postgres in Docker has more background on configuring Postgres properly.
How do I update ElectricSQL?
Change the image tag in your service settings and redeploy. Check Docker Hub for the latest stable version.
Are there alternatives to ElectricSQL?
Yes, depending on what you actually need. For change data capture at scale, Debezium is the classic option. For local-first replication, look at PowerSync or Zero. If you just want a realtime channel over Postgres changes, Supabase Realtime works well.
Can I run this without exposing it publicly?
Yes. Set the service to private in Sliplane and only allow access from your own backend (via Sliplane's internal network). That way the ELECTRIC_SECRET never has to leave your infrastructure.