
ZeroSync + Postgres
Rocicorp's ZeroSync engine for local-first apps
ZeroSync
rocicorp/zero:0.15.2025021402
Just deployed
/zero-data
Postgres
railwayapp-templates/postgres-ssl:16
Just deployed
/var/lib/postgresql/data
Initial setup
This template creates both the Postgres instance and the Zero sync engine.
After deploying for the first time,
- Open the generated public endpoint in a new tab. If you see an
ok
it means everything is working. - To connect to Zero via your web application, you can use the
ZERO_PUBLIC_URL
.
Permissions
In Zero, access is denied by default. To be able to sync data to your application, you will first need to set up permissions. It's best to read this page to understand how it works.
Although you describe permissions by calling functions in Typescript, permissions are actually compiled into JSON and then uploaded to your Postgres instance. Once you defined your permissions, you will have to run the following command:
npx zero-deploy-permissions -p ./path/to/schema --upstream-db ${DATABASE_PUBLIC_URL}
Configuration
You may have to play around with the ZERO_NUM_SYNC_WORKERS
to figure out what works best depending on the your service's allocated resources. Decrease/increase this value depending on how many upstream connections your service resources allow.
Template Content