Migrate from Railway to Self-Hosted

Railway and Temps share the same deployment model — Git push, auto-detect, run in containers. If your app deploys on Railway it deploys on Temps with minimal changes. The main difference is databases: Railway provides managed Postgres; on Temps you bring your own or use Temps's managed database service.


Applications

Nixpacks Compatibility

Railway uses Nixpacks to build apps without a Dockerfile. Temps supports Nixpacks-built projects — if your repo has no Dockerfile, Temps auto-detects your framework the same way Railway does.

If you want an explicit build definition, add a Dockerfile at the repo root. Temps will use it automatically.

Environment Variables

Add environment variables

  1. 1

    In Railway, open Project then Variables then Raw Editor and copy the variables in .env format.

  2. 2

    In Temps, open Project then Settings then Environment Variables and paste them in.

  3. 3

    Remove or replace Railway-specific variables (PORT, RAILWAY_ENVIRONMENT, the Railway DATABASE_URL) using their Temps equivalents.

Export your Railway variables from Railway → Project → Variables → Raw Editor (copy the .env format), then add them in Temps → Project → Settings → Environment Variables (see environment variables for full reference).

Railway injects a few platform variables automatically (RAILWAY_ENVIRONMENT, PORT, etc.). Remove or replace Railway-specific ones:

Railway variableTemps equivalent
PORTSet explicitly or use 8080 (Temps default)
RAILWAY_ENVIRONMENTUse NODE_ENV or a custom TEMPS_ENV var
DATABASE_URL (Railway Postgres)Your new database URL (see below)

Deploy

Create and deploy the project

  1. 1

    Install Temps if you have not already: curl -fsSL https://temps.sh/deploy.sh | bash

  2. 2

    Go to Projects then New Project in the Temps console.

  3. 3

    Connect your Git repository and select your branch.

  4. 4

    Add environment variables.

  5. 5

    Click Deploy.

    Checkpoint: Wait until the deployment completes and the app responds at its Temps preview URL before cutting over DNS.

# Install Temps if not already done
curl -fsSL https://temps.sh/deploy.sh | bash
  1. Go to Projects → New Project in the Temps console
  2. Connect your Git repository and select your branch
  3. Add environment variables
  4. Click Deploy

Databases

Railway provides a managed Postgres service that injects DATABASE_URL automatically. On Temps, choose one of (see managed services and deploy with a database for full details):

  • Temps Managed Services — provision a PostgreSQL container inside Temps (same server, private network, simplest path)
  • External provider — Neon, Supabase, PlanetScale, or any hosted Postgres
  • Self-hosted on your VPS — run Postgres in a Docker container alongside your app

Step 1: Export from Railway Postgres

Find your Railway database URL: Railway → Project → your Postgres service → Variables → DATABASE_URL.

# Export a compressed, portable backup
pg_dump "$RAILWAY_DATABASE_URL" \
  --no-acl \
  --no-owner \
  -Fc \
  -f railway_backup.dump

# Verify the dump is readable
pg_restore --list railway_backup.dump | head -20

Step 2: Create the New Database

Create a managed Postgres database

  1. 1

    In the Temps dashboard, go to Managed Services then New Service then PostgreSQL.

  2. 2

    Choose a name (for example myapp-db).

  3. 3

    Temps creates a Postgres instance and shows you the connection string.

    Checkpoint: Copy the connection string from the service detail page; you will set it as DATABASE_URL next.

Option A — Temps Managed Postgres (recommended):

  1. In the Temps dashboard, go to Managed Services → New Service → PostgreSQL
  2. Choose a name (e.g. myapp-db)
  3. Temps creates a Postgres instance and shows you the connection string

Option B — External Postgres: Create a database at Neon, Supabase, or any Postgres host and copy the connection string.

Step 3: Restore Your Data

# Restore to the new database
pg_restore \
  --clean \
  --if-exists \
  -d "$NEW_DATABASE_URL" \
  railway_backup.dump

# Sanity check — compare row counts between old and new
psql "$RAILWAY_DATABASE_URL" -c "SELECT schemaname, tablename, n_live_tup FROM pg_stat_user_tables ORDER BY n_live_tup DESC LIMIT 10;"
psql "$NEW_DATABASE_URL"     -c "SELECT schemaname, tablename, n_live_tup FROM pg_stat_user_tables ORDER BY n_live_tup DESC LIMIT 10;"

Step 4: Update the Connection String

Update DATABASE_URL

  1. 1

    Open the my-app project then Settings then Environment Variables.

  2. 2

    Set DATABASE_URL to the new connection string (for a Temps managed Postgres on the same server: postgresql://postgres:yourpassword@localhost:16432/yourdb; for an external database, use the provider's string).

  3. 3

    Save the variable so the next deploy picks it up.

    Checkpoint: Redeploy and confirm the app connects to the new database before touching DNS.

Update DATABASE_URL in your Temps environment variables. For a Temps managed Postgres on the same server, the format is:

postgresql://postgres:yourpassword@localhost:16432/yourdb

For an external database, use the provider's connection string directly.


Volumes and persistent storage

Railway supports persistent volumes for storing files between deploys. On Temps, mount a directory from your VPS into the container via Project → Settings → Volumes, or use object storage (Cloudflare R2, MinIO) for file uploads.


Templates

Railway templates are pre-configured stacks (e.g. "Node + Postgres"). Temps doesn't have a template marketplace, but the examples page covers common stacks with working configs.


Verify and cut over DNS

Add a custom domain and cut over DNS

  1. 1

    Find your numeric project ID with: bunx @temps-sdk/cli projects show -p my-app --json (look for the id field).

  2. 2

    Confirm your app works at the Temps preview URL before touching DNS.

    Checkpoint: Open the preview URL and run your test suite first.

  3. 3

    Go to Project then Settings then Domains then Add Domain.

  4. 4

    Add the A or CNAME record shown at your DNS provider.

  5. 5

    Temps provisions TLS automatically.

    Checkpoint: Keep your Railway project running for 48 hours as a fallback in case you need to roll back.

  1. Confirm your app works at the Temps preview URL before touching DNS
  2. Go to Project → Settings → Domains → Add Domain
  3. Add the A or CNAME record shown
  4. Temps provisions TLS automatically

Keep your Railway project running for 48 hours as a fallback.

Was this page helpful?