Deploying Rebase on Railway
Railway is an incredibly popular modern PaaS (Platform as a Service) that takes the pain out of DevOps. It will automatically detect the Rebase Node framework and build it seamlessly.
Additionally, Railway fully supports European deployment regions (Amsterdam), meaning you still enjoy strict regional hosting compliance.
1. Create a Project & EU Region
Section titled “1. Create a Project & EU Region”- Login to your Railway Account.
- Click New Project.
- Go to Settings -> Default Region, and explicitly set it to Europe (Amsterdam). (If you do this after creating services, you may need to manually migrate them).
2. Provision PostgreSQL
Section titled “2. Provision PostgreSQL”- Inside your project, click New -> Database -> Add PostgreSQL.
- Wait a few seconds for the database to provision.
- By default, Railway provides an internal
DATABASE_URLvariable. Click on the Postgres widget -> Variables to locate this connection string.
3. Deploy Rebase Code
Section titled “3. Deploy Rebase Code”- Click New -> GitHub Repo.
- Select your Rebase repository.
- Railway will immediately detect the repository and look for a
Dockerfile. Wait for the initial build to begin.
4. Set Environment Variables
Section titled “4. Set Environment Variables”The initial build might fail because it is entirely missing configuration. Let’s fix that.
- Click on the new Rebase GitHub service card.
- Go to the Variables tab.
- Click New Variable and add:
JWT_SECRET: Generate a secure 32+ character random string.REBASE_SERVICE_KEY: Generate another secure 32+ character random string.NODE_ENV: Set toproductionCORS_ORIGINS: Your frontend domain (e.g.,https://your-app.up.railway.app)FRONTEND_URL: Same as CORS_ORIGINSALLOW_REGISTRATION: Set tofalseafter creating your admin account
- Click Reference Variable and select
DATABASE_URLfrom the PostgreSQL service you provisioned. Railway will securely inject the internal Postgres URL at runtime.
5. Expose the Domain
Section titled “5. Expose the Domain”- In the Rebase service card, navigate to the Settings tab.
- Scroll down to Networking.
- Under Public Networking, click Generate Domain. Railway will provide a
.up.railway.apptesting URL. You can also securely attach a Custom Domain here.
Railway will automatically rebuild safely. Your EU-hosted platform is now entirely live!
6. Create the Database Schema
Section titled “6. Create the Database Schema”The app is running, but Rebase only auto-creates the auth tables on boot — the tables for your own collections are not created automatically. Run this once against the production database, or every collection returns a “missing table” error:
pnpm run db:pushRun it from a checkout of your project (or your CI job) with DATABASE_URL set to your Postgres service’s public connection string (found under the Postgres widget → Connect; the referenced internal DATABASE_URL is only reachable from inside Railway). The deployed image doesn’t include the CLI, so this doesn’t run inside the container. For versioned migrations, commit migration files with pnpm run db:generate and run pnpm run db:migrate instead.
