Railway + PowerSync
Integration guide for deploying a Postgres database and custom backend using Railway for Postgres and Node.js hosting.
Railway is an attractive alternative to managed solutions such as Supabase, well suited to users looking for more control without going the full IaaS route.
Deploying to Railway
Step 1: Deploy on Railway
Find the PowerSync template on the Railway Marketplace, or click below:
Step 2: Configure Your Database
Create a
powersync
publication as described here: Create "powersync" PublicationOptionally filter the publication table list to only include tables that you want clients to download
[Optional] Create a Postgres user for PowerSync to use as described here: Create a PowerSync Database User
Step 3: Configure Railway and PowerSync
Once your project is deployed, clone the repo that Railway created and follow the instructions to generate the JWT config for these environment variables:
POWERSYNC_JWT_PRIVATEKEY
POWERSYNC_JWT_PUBLICKEY
Sign up for a PowerSync account
Follow the steps to create a PowerSync instance as documented here: Connect PowerSync to Your Database
Once your instance has been provisioned, right-click on the instance and copy the instance URL
Set this as the
POWERSYNC_URL
environment variable in Railway
Step 4: Build Out Your Database
This typically consists of the below activities:
Create your schema
Add any new tables to the
powersync
publication previously createdLoad some test data
Step 5: Build Out Your Backend
See the Node.js backend app for instructions:
https://github.com/powersync-ja/powersync-railway-nodejs-template
An example implementation using Firebase for auth is available here:
https://github.com/powersync-ja/powersync-nodejs-firebase-backend-todolist-demo
Step 6: Connect Your Client
See these docs for instructions to connect your app to your backend and PowerSync: Client-side Setup
Last updated