Step 1: Deploy on Railway
Find the PowerSync template on the Railway Marketplace, or click the button below to get started:Deploy on Railway
This template automatically creates
lists and todos tables in your Postgres database. The default Sync Rules are configured to sync these tables to your clients.The Execute Scripts service creates the powersync publication for these tables. We recommend limiting the publication to only the tables you want clients to download.Want to add more tables?
Want to add more tables?
Once you’re up and running with the default Option 2: Use the Execute Scripts serviceThe Execute Scripts service can also be used as a general-purpose tool to apply schema changes to your PowerSync Postgres instance:
lists and todos tables, you can add more tables at any time using either of these approaches:Option 1: Use your existing Postgres toolsManage your database schema as you normally would. For example, using psql:- Add your new table creation statements and publication updates to the Execute Scripts code
- Redeploy the Execute Scripts service
- Update the Sync Rules in your YAML config (Step 2) to include the new tables
- Re-encode the YAML to base64 and update the
POWERSYNC_CONFIG_B64environment variable
Step 2: Configure PowerSync Service
Let’s fix this by generating the config, setting the variable, and restarting the service.1
Copy the YAML config
Start with the configuration below and update the Sync Rules to match your schema:
2
Replace the placeholders
Replace each placeholder with the corresponding values from Railway:
${POSTGRES_SOURCE_URL}
${POSTGRES_SOURCE_URL}
Click on Postgres Source Data → Variables → copy
DATABASE_URL${POSTGRES_BUCKET_URL}
${POSTGRES_BUCKET_URL}
Click on Postgres (PowerSync Bucket Storage) → Variables → copy
DATABASE_URL${BACKEND_PUBLIC_URL}
${BACKEND_PUBLIC_URL}
Click on Node Backend → Settings → Networking → copy the URL
${POWERSYNC_PUBLIC_URL}
${POWERSYNC_PUBLIC_URL}
Click on PowerSync Service → Settings → Networking → copy the URL
3
Encode and deploy
Once you’ve replaced all placeholders:
- Use a base64 encoding tool to encode the YAML file
- Copy the encoded string to the
POWERSYNC_CONFIG_B64environment variable in the PowerSync Service - Redeploy when prompted
Step 3: Test with the diagnostics app
- Generate a development token
- Open the PowerSync Diagnostics App service
- Paste your token to test your connection and Sync Rules
Step 4: Connect Your Client
Client-Side Setup
Follow our guide to connect your app to your backend and PowerSync instance