
Deploy Electric
ElectricSQL 1.8 Postgres sync engine that streams shapes over HTTP.
Just deployed
/var/lib/postgresql/data
electric
Just deployed
/var/lib/electric/persistent
Deploy and Host Electric on Railway
Electric is a Postgres sync engine. It reads changes through logical replication and streams subsets of your data, called shapes, to web and mobile clients over plain HTTP, with initial snapshots and live updates. It powers local-first apps and works with TanStack DB, React hooks and any HTTP client, behind your own API.
About Hosting Electric
This template deploys Electric v1.8.1 from the official image with a Railway Postgres database started with wal_level=logical. Shape logs are cached on a Railway volume so they survive redeploys. Every shape request must include the generated ELECTRIC_SECRET, so keep it on your backend and proxy shape requests through your API rather than calling Electric from the browser. Electric listens on IPv4 and IPv6, so your API can reach it over the private network. Usage reporting is off. It fits the Hobby plan for small datasets. Add a proxy route in your API that appends the secret and checks the user's access first.
Common Use Cases
- Real-time sync of Postgres data into web and mobile apps
- Local-first apps with TanStack DB or other client stores
- Live dashboards and collaborative views without a WebSocket server
Dependencies for Electric Hosting
electricsql/electric:1.8.1(official image)- Railway Postgres (
ghcr.io/railwayapp-templates/postgres-ssl:18) withwal_level=logicaland a volume - A Railway volume at
/var/lib/electric/persistent
Deployment Dependencies
Implementation Details
| Service | Image | Networking | Storage |
|---|---|---|---|
| electric | electricsql/electric:1.8.1 | public domain on 3000; private IPv4/IPv6 | volume at /var/lib/electric/persistent |
| Postgres | Railway Postgres 18, wal_level=logical | private only | volume |
curl "$ELECTRIC_PRIVATE_URL/v1/shape?table=todos&offset=-1&secret=$ELECTRIC_SECRET"
| Variable | Default | Purpose |
|---|---|---|
ELECTRIC_SECRET | generated | Required on every shape request |
DATABASE_URL | Postgres reference | Source database |
ELECTRIC_PRIVATE_URL | private URL | For your API proxy |
Notes:
- The Postgres start command adds
-c wal_level=logical; keep it when editing the database service. - Responses are paged: after the first snapshot page, follow the returned offset and handle to get live changes.
This is a community-maintained deployment package and does not imply affiliation with or endorsement by the Electric project or its maintainers.
Why Deploy Electric on Railway?
Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.
By deploying Electric on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.
Template Content