---
title: "Migrate from Railway"
description: "Move a Railway service to dply: import railway.json or railway.toml, copy variables, replace Railway databases with dply resources, and switch the domain."
---

This guide is for services deployed on Railway from a Git repository. dply reads `railway.json` or `railway.toml` on the create page, so your build and start commands come with you. Services run as [container apps](/docs/containers) that sleep when idle, with databases and Valkey attached as resources.

## How the pieces map

| Railway | dply |
|---|---|
| Service | A container app, or a static site |
| `railway.json`, `railway.toml` | Build and start commands imported (see below) |
| Nixpacks or Railpack builds | A generated image for the detected stack, or your own `Dockerfile` ([Frameworks & runtimes](/docs/frameworks)) |
| Pre-deploy command | The release command: `build.release` in `dply.yaml` or a `Procfile` `release:` line ([Procfile](/docs/configuration-files#procfile)) |
| Variables and shared variables | **Environment** ([Environment variables](/docs/environment-variables)) |
| Postgres, MySQL | dply Postgres or MySQL ([Postgres, MySQL & MongoDB](/docs/resources/databases)) |
| Redis | dply Valkey ([Valkey (Redis)](/docs/resources/valkey)) |
| Volumes | Not available. Use [object storage](/docs/resources/object-storage) |
| Cron schedule | A **Scheduled task** ([Scheduled tasks](/docs/scheduled-tasks)) |
| Replicas, serverless sleep | Instances and **Sleeps after** ([Scaling & sleep](/docs/scaling-and-sleep)) |
| PR environments | [Preview deployments](/docs/preview-deployments) |
| `*.up.railway.app` | The app's `*.on-dply.live` hostname ([Domains](/docs/domains)) |
| Rollback | **Roll back** ([Deployments](/docs/deployments#roll-back)) |

## What the import covers

When the repository has a `railway.json` or `railway.toml` and no `dply.yaml`, dply uses its `build.buildCommand` and `deploy.startCommand` ahead of what it would detect. A service with `deploy.cronSchedule` gets a note in the build log: add it as a scheduled task instead of a web app. Other settings, such as health checks and restart policies, aren't read.

Each Railway service in a project is its own app on dply. Create one app per service, with **Repository root** set for a monorepo. See [Monorepos](/docs/monorepos).

## 1. Deploy the app

1. Choose **New app**, connect your source control, and select the repository and branch.
2. Check the detected build and start commands, then choose **Deploy**.

## 2. Copy variables

In Railway, open the service's **Variables** tab and choose **Raw Editor** to copy them in `.env` format. Paste them into **Environment** on dply. Leave out variables that reference other Railway services, such as `DATABASE_URL` and `REDIS_URL`: dply sets them from the resources you attach next.

## 3. Attach resources

On the app's **Overview**, choose **Add resource** and add a **Database** (Postgres or MySQL) and **dply Valkey** for Redis. Redeploy so the app receives the new variables.

## 4. Move the database

1. Stop writes to the Railway service.
2. Export with the database's public connection URL from Railway:

   ```bash
   pg_dump --no-owner --no-acl -Fc "$RAILWAY_DATABASE_URL" > app.dump
   ```

3. Open the database from the app's **Overview**. Under **Export and import**, choose **Get upload command**, run it where `app.dump` is, then choose **Load it**.

For MySQL, upload isn't available: export with `mysqldump --single-transaction` and restore with `mysql` using the **Connection URL** under **Connect**. See [Postgres, MySQL & MongoDB](/docs/resources/databases#export-and-import).

## 5. Switch the domain

1. Check the app on its `on-dply.live` address.
2. Add the domain under **Routing**, **Domains**.
3. Lower the TTL on the existing record, then point it at the CNAME target dply shows.
4. Choose **Verify DNS** and wait for TLS to be active.
5. Remove the custom domain from Railway, then remove the service.

See [Domains](/docs/domains).

## Next steps

- [Container apps](/docs/containers)
- [Scaling & sleep](/docs/scaling-and-sleep)
- [Troubleshooting builds](/docs/guides/troubleshooting-builds)
