---
title: Migrate from Heroku
description: Learn how to migrate your apps from Heroku to Railway with this step-by-step guide. Fast, seamless, and hassle-free.
---
Migrating your app from Heroku to Railway is very simple. We even support Procfiles out of the box. (Only a single process is supported for now).

All you need to do is create a project in Railway, push your code, and migrate your environment variables.

This guide will step you through the process of migrating a simple web service, using the [Railway CLI](/cli).

<Image src="https://res.cloudinary.com/railway/image/upload/v1695765903/docs/heroku-migration/intro1_uauodg.gif"
alt="Screenshot of Railway Up"
layout="intrinsic"
width={700} height={464} quality={80} />

## Working directory

In your terminal, ensure your current working directory is the same directory where your service code is located.

This is important so that as you complete the following steps, the [Railway CLI](/cli) is properly linked.

## 1. Login to Railway from the CLI

Ensure your CLI is authenticated to your Railway account:

```bash
railway login
```

This command will prompt to open a browser to complete authentication. Once authenticated, commands executed by the Railway CLI, will be performed in the context of your Railway account.

## 2. Create a new project

Now, let's create a new [project](/projects):

```bash
railway init
```

This command will prompt you to define a name for your service.

## 3. Deploy the service

Once your project is created, you can push your code into the project and assign a domain.

### Push the Code

Push the code into a [service](/services) in Railway:

```bash
railway up -d
```

At this point, the service is being deployed, but let's give it a domain.

### Assign a domain

The service being migrated is a web service that should be available over the Internet, so let's assign a domain:

```bash
railway domain
```

Now the service will be available over the Internet via the provided domain.

## 4. Migrate the environment variables

Finally, copy your config vars from Heroku into Railway.

### Export your Heroku config vars

Print your Heroku app's config vars in `.env` format:

```bash
heroku config --shell --app <your-heroku-app>
```

### Add them to the service

Open the project in the [Railway canvas](/projects#project-canvas):

```bash
railway open
```

Then add the variables to the service:

- click on the service
- click the `Variables` tab
- click `Raw Editor`
- paste the output of `heroku config --shell` and click `Update Variables`
- [deploy the staged changes](/deployments/staged-changes)

## Conclusion

Following this guide, you have successfully migrated a simple web service from Heroku to Railway, including its environment variables.

The migration is complete by pushing your code directly from your local machine into a service in Railway. Once you are comfortable with Railway, you may want to integrate [deployments](/deployments) into your development workflow.

For more advanced operations, like migrating your databases from Heroku to Railway, the process will be a bit more involved, but we are happy to help work out a solution!

## Need help?

If you run into any issues, or would like help with your migrations, we would be more than happy to answer your questions on [Central Station](https://station.railway.com) or over email at [team@railway.com](mailto:team@railway.com).