---
title: "Deploy Electric"
description: "ElectricSQL 1.8 Postgres sync engine that streams shapes over HTTP."
category: "Queues"
url: https://railway.com/deploy/electric
---

# Deploy Electric

ElectricSQL 1.8 Postgres sync engine that streams shapes over HTTP.

**[Deploy Electric on Railway](https://railway.com/template/electric)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/electric/manifest.json

- **Creator:** Agaz Self-Host
- **Category:** Queues

## Template content

### Postgres https://devicons.railway.app/i/postgresql.svg

- **Image:** ghcr.io/railwayapp-templates/postgres-ssl:18
- **Start command:** `/usr/bin/tini -g -- /usr/local/bin/wrapper.sh postgres -p 5432 -c wal_level=logical`

### electric https://github.com/electric-sql.png

- **Image:** electricsql/electric:1.8.1
- **Health check:** /v1/health
- **Public domain:** Yes

## Documentation

# 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

- [Electric documentation](https://electric-sql.com/docs/intro)
- [Electric releases](https://github.com/electric-sql/electric/releases)
- [Security guide](https://electric-sql.com/docs/guides/security)
- [Railway private networking](https://docs.railway.com/reference/private-networking)

### 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 |

```bash
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.


## Similar templates

- [Redpanda](https://railway.com/deploy/redpanda-1) — Redpanda 26.2: Kafka-compatible streaming, single node, with Kafbat UI.
- [smoothmq](https://railway.com/deploy/AJv-64) — A drop-in replacement for AWS SQS
- [Kafka UI](https://railway.com/deploy/kafka-ui) — Kafbat UI — Open-source web UI to monitor and manage Apache Kafka clusters

Open this page in a browser: https://railway.com/deploy/electric
