
Deploy Zero Sync | (Just Updated) Realtime Sync Engine for Postgres, Secrets Generated
Zero sync engine plus Postgres, logical replication and secrets generated
postgres
Just deployed
/var/lib/postgresql
zero-cache
Just deployed
/data
Deploy and Host Zero on Railway
Zero is the open-source sync engine from Rocicorp. It sits in front of Postgres, replicates the tables you choose into a SQLite replica, and streams query results to web and mobile clients over WebSocket, so apps read and write instantly and stay in sync. This template deploys zero-cache 1.11 together with a Postgres 18 database that is already configured for logical replication. Passwords are generated for you, so nothing needs filling in.
About Hosting Zero
The template runs two services. postgres is the official Postgres 18 image started with wal_level=logical (Zero requires it) and seeded with a small public.todos table. zero-cache is the official rocicorp/zero image pinned by digest; it connects to Postgres over the private network, creates its publication and replication slot on first boot, and keeps its replica on a volume at /data. Health is GET /keepalive.
Why Deploy Zero on Railway?
- No manual step: Postgres is pre-configured for logical replication and both passwords are generated.
- Public HTTPS and WSS endpoint with the health path wired up.
- The Postgres data and the Zero replica both sit on volumes, so a redeploy keeps them.
- Legacy queries and CRUD mutations are enabled, so a client can connect with only a schema.
Common Use Cases
- Local-first and instant-UI web apps that read from a synced local cache.
- Multiplayer apps where several clients and AI agents see the same data change live.
- Replacing hand-written REST polling and cache invalidation with query subscriptions.
- A self-hosted alternative to hosted sync services such as Convex or Firebase.
Dependencies for Zero Hosting
Deployment Dependencies
- Image: rocicorp/zero (zero-cache 1.11.0), pinned by digest
- Database: Postgres 18 with
wal_level=logical, volume at/var/lib/postgresql - Docs: https://zero.rocicorp.dev/docs
- Replica volume mounted at
/data
Machine-readable contract
service: zero-cache
base_url: https://
health: GET /keepalive -> 200
websocket: wss:/// (ZeroProvider server option = base_url)
credential_variables:
ZERO_ADMIN_PASSWORD (zero-cache; admin/inspector access)
POSTGRES_PASSWORD (postgres service)
connection_variables:
ZERO_UPSTREAM_DB (postgres://postgres:@:5432/postgres)
seed_table: public.todos (id, task, done)
volumes: /data (zero-cache replica), /var/lib/postgresql (postgres)
Check health:
curl https:///keepalive
Connect a client:
import { Zero } from "@rocicorp/zero";
const z = new Zero({ server: "https://", userID: "anon", schema });
const todos = await z.query.todos.run();
Template Content
postgres
postgres:18.6zero-cache
rocicorp/zero