3 months ago
We are introducing a new CLI command that we would like to get your feedback on. It is still early days
railway dev
The goal of this command is to make it easier to develop your project locally with the exact same setup that is in your Railway environment
What the command currently does
Creates, starts, and manages a docker compose file in the background for all your image services. This includes things like Postgres/Redis databases, or anything deployed from DockerHub and GHCR
Generates certs and starts a reverse proxy with pretty
{service}.{project}.railway.localhostdomains for all services that are configured with a public domainAutomatically updates variables that reference the public/private domain and tcp proxy to point to the locally running services. This means that if a service is configured to connect to a Postgres database over the private network, it will work locally
Starts 0 or many local commands for services in your environment. This means you can specify that your “web” service has development command “bun run dev” and runs on port 8000. When you run
railway devit will automatically be started with variables pointing to the other local services that are running
How to use it and test today
Install the latest version of the Railway CLI
In a directly that is linked to a Railway project, run
railway devYou will be prompted to optionally configure any code services (command, directory, port). You can skip this and set it up at any time with
railway dev configureEverything will be started and you will see URLs you can use to connect
You can also run
railway run {cmd} —service {service}anywhere and it will replace the variables to point to local databases too
Caveats
You need to have Docker installed and running locally
Buckets and Railway functions don’t work yet
Windows support is limited
When Railway started, it was always our goal to make the entire development process easier, and this extends to local development. Right now, you can configure a database or template with one click on railway.com, but spinning that up locally is a bit of a pain. This is the start of us making that easier.
It is still early and there will likely be bugs and big changes. We welcome in and all feedback.
12 Replies
3 months ago
Holy crap. I was literally looking for this right this moment after seeing Supabase local dev CLI mode, and you just posted 2 hours ago.
This is ABSOLUTELY NEEDED and I am firing it up right now. Thank you!
3 months ago
This is an exciting addition, but curious how it would work practically - i.e. accessing the files on this dev container so one can actually develop on it...
Currently we have an EC2 on AWS as our dev server as we then use VSCode to remote SSH in to the server, so we can actively work on the remote flies. Is there a plan for file access on these dev containers?
Thanks
rjbathgate
This is an exciting addition, but curious how it would work practically - i.e. accessing the files on this dev container so one can actually develop on it...Currently we have an EC2 on AWS as our dev server as we then use VSCode to remote SSH in to the server, so we can actively work on the remote flies. Is there a plan for file access on these dev containers?Thanks
3 months ago
railway dev does not (yet) spin up a remote development machine. Everything is local and runs on your computer.
jr
railway dev does not (yet) spin up a remote development machine. Everything is local and runs on your computer.
3 months ago
Oh sh*t that is very exciting... Looking forward to having a play (and for better Windows support - you mention it's limited, but not sure how and what)
3 months ago
Is there a way to override some of the env vars? For example, I don't want the rollbar env vars to be used locally.
jasonfma
Is there a way to override some of the env vars? For example, I don't want the rollbar env vars to be used locally.
3 months ago
That is a good idea. Right now the only way would be to create a new environment on Railway that only has the variables you want to use and link to that. But we could add a way of overriding the variable values. How would you expect this to work? Manually passing a flag, reading .env files, something else?
jr
That is a good idea. Right now the only way would be to create a new environment on Railway that only has the variables you want to use and link to that. But we could add a way of overriding the variable values. How would you expect this to work? Manually passing a flag, reading .env files, something else?
3 months ago
I'd love to be able to use .env to set these. We already use it and I could just clean up the ones that point to my manually set up local dbs.
2 months ago
This is amazing and exactly what I needed! Are there plans to enable agents to interact with this?
Does railway dev configure work non-interactively?
Can railway dev run in daemon/background mode?
Is there a --json flag for machine-readable output?
Will MCP server support be added?
raiperez
This is amazing and exactly what I needed! Are there plans to enable agents to interact with this?Does railway dev configure work non-interactively?Can railway dev run in daemon/background mode?Is there a --json flag for machine-readable output?Will MCP server support be added?
2 months ago
This is a great question and definitely something we are thinking about. At the moment it is a bit difficult for agents, mainly for point number 2. There is no daemon or background mode and the services are stopped when you ctrl+c. This is definitely on our roadmap though, just not something we wanted to prevent us from shipping this early version.
jr
This is a great question and definitely something we are thinking about. At the moment it is a bit difficult for agents, mainly for point number 2. There is no daemon or background mode and the services are stopped when you ctrl+c. This is definitely on our roadmap though, just not something we wanted to prevent us from shipping this early version.
2 months ago
Thanks for the quick reply! I would be VERY interested in participating in some kind of early user testing if that is ever available
2 months ago
Super silly question on the TUI. Is there a way to select/copy/paste from the logs? I can't seem to do so from the Mac default terminal or Cursor integrated terminal (PS: I've had the same war before with turbo, so cheers)



