Deploy Electric

ElectricSQL 1.8 Postgres sync engine that streams shapes over HTTP.

Deploy Electric

/var/lib/postgresql/data

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) with wal_level=logical and a volume
  • A Railway volume at /var/lib/electric/persistent

Deployment Dependencies

Implementation Details

ServiceImageNetworkingStorage
electricelectricsql/electric:1.8.1public domain on 3000; private IPv4/IPv6volume at /var/lib/electric/persistent
PostgresRailway Postgres 18, wal_level=logicalprivate onlyvolume
curl "$ELECTRIC_PRIVATE_URL/v1/shape?table=todos&offset=-1&secret=$ELECTRIC_SECRET"
VariableDefaultPurpose
ELECTRIC_SECRETgeneratedRequired on every shape request
DATABASE_URLPostgres referenceSource database
ELECTRIC_PRIVATE_URLprivate URLFor 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

More templates in this category

View Template
smoothmq
A drop-in replacement for AWS SQS

poundifdef
7
View Template
Kafka UI
Kafbat UI — Open-source web UI to monitor and manage Apache Kafka clusters

codestorm
0
View Template
NEW
NATS + JetStream
An open source messaging system that promises at-most-once delivery.

Brayan Castaneda
1