
ZeroSync
Rocicorp's ZeroSync engine for local-first apps
ZeroSync
rocicorp/zero:0.15.2025021402
Just deployed
/zero-data
Initial setup
This template only creates the sync engine. You will need to bring your own Postgres instance.
Before deploying for the first time,
- Manually set the
PG_DATABASE_URL
environment variable. This should be the private URL. - Next you will need to update your Postgres' instance WAL level to
logical
.- You can follow the official documentation here for a more detailed explanation on how to do it. If you are comfortable with Postgres and SQL, here is the short version:
- Connect to your existing Postgres instance, and run
"ALTER SYSTEM SET wal_level = 'logical'
. Next restart your running Postgres instance.
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}
Note that DATABASE_PUBLIC_URL
is the public URL to your database, not the private URL that you set up before deploying.
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
ZeroSync
rocicorp/zero:0.15.2025021402PG_DATABSE_URL
Postgres connection URL.