Migrate from Heroku
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.

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 is properly linked.
1. Login to Railway from the CLI
Ensure your CLI is authenticated to your Railway account:
railway loginThis 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:
railway initThis 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 in Railway:
railway up -dAt 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:
railway domainNow 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:
heroku config --shell --app <your-heroku-app>Add them to the service
Open the project in the Railway canvas:
railway openThen add the variables to the service:
- click on the service
- click the
Variablestab - click
Raw Editor - paste the output of
heroku config --shelland clickUpdate Variables - deploy the 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 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 or over email at team@railway.com.