Links

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:
Deploy on Railway

Step 2: Configure Your Database

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 created
  • Load some test data

Step 5: Build Out Your Backend

See the Node.js backend app for instructions:
An example implementation using Firebase for auth is available here:

Step 6: Connect Your Client

See these docs for instructions to connect your app to your backend and PowerSync: Client-side Setup