Run Claude Code in the cloud on Railway

By Tracklayer · Updated 2026-11-20

Short answer: to keep Claude Code, Codex or another coding agent working when your laptop is closed, run it on an always-on Linux box and start it inside tmux. On Railway you can deploy such a box from a template: it gives you SSH and a browser terminal, preinstalled agent CLIs, and a persistent volume for projects and logins. You connect, start the agent, disconnect, and check back from any device.

Deploy the Ubuntu 26.04 cloud dev box on Railway

The template’s name still says “Ubuntu 24.04” in its listing address; the image it builds is Ubuntu 26.04 LTS.

When a cloud dev box makes sense

A coding agent runs as a process on whatever machine you start it on. Close the lid and a local session stops. A cloud box helps when:

You still bring your own accounts: a Claude plan or Anthropic API key, a ChatGPT plan or OpenAI API key, and so on. The box does not include model access.

Which dev box templates people deploy

TemplateCreatorDeploymentsServices
Ubuntu-LinuxXenaaLangliss4,9261
Ubuntu SSH + ClaudeParham_79914,6821
Debian-LinuxXenaaLangliss2,8831
Kali Linux (Web Terminal)decoge2,6321
Debian Linux | Open Source Web Terminal for RailwayKayra Kryo's Projects1,4901
Ubuntu 26.04decoge1,0251
Ubuntu 24.04decoge7801
Ubuntu 26.04 (Web Terminal)decoge6521

Railway marketplace data as of 2026-11-19. Full ranking: Best cloud dev environments and browser terminals on Railway.

Check each template’s services and variables before deploying. What matters for coding agents: is there a volume, how do you log in, and which agent CLIs are installed.

Deploy the dev box, step by step

These steps use Tracklayer’s Ubuntu 26.04 SSH + Claude Code + Codex template.

  1. Deploy the template. Nothing needs filling in; both passwords are generated. The first build takes about 3 to 5 minutes.
  2. Open the web terminal. Open the service’s public URL and click Open the web terminal. The user is dev and the password is WEB_PASSWORD on the Variables tab.
  3. Or connect with SSH. Copy SSH_PASSWORD from Variables, then run ssh -p {RAILWAY_TCP_PROXY_PORT} dev@{RAILWAY_TCP_PROXY_DOMAIN}. The deploy logs print the exact command. For key-only access, paste your public key into SSH_AUTHORIZED_KEYS, redeploy, then clear SSH_PASSWORD.
  4. Start a persistent session. Run tmux new -A -s main. Anything started inside it keeps running when you disconnect.
  5. Sign in to your agent. Run claude and open the login URL on your computer, then paste the code back. Alternatively set ANTHROPIC_API_KEY. For Codex, run codex login --device-auth or set OPENAI_API_KEY. Gemini CLI and OpenCode are installed too.
  6. Clone a repository and start the agent. Projects go in ~/workspace. For private repositories the template suggests a GitHub token. Detach from tmux, close the tab, and come back later.

What persists and what does not

Everything under /home/dev is on a Railway volume: projects, CLI logins, dotfiles, and per-user installs such as npm i -g, pipx and uv tool. Packages installed with sudo apt reset on redeploy; list them in APT_PACKAGES to have them reinstalled at every start. tmux sessions survive disconnects, not restarts. SSH host keys also stay on the volume, so your client does not warn about a changed host key after a redeploy.

What it costs

Railway bills usage, so cost follows the memory and CPU the box uses, plus the volume. The template’s spec contains one measurement and two estimates:

Profile Approx. cost per month Basis
Idle, nobody connected (about 0.13 GB RAM, 1 GB volume) about $1.5 Measured RAM
One agent in tmux a few hours a day, occasional builds about $12 Estimate
Two or three agents around the clock, frequent builds about $40 Estimate

Model usage is billed by your provider, not by Railway. One agent session fits in 1 GB of RAM; builds and parallel agents need more, so the template points to the Hobby or Pro plan for real work.

Limits and licence notes

Other options

For the full ranking, see cloud dev environments on Railway. More guides are listed at /guides/.

FAQ

Does Claude Code keep running after I close my laptop?

Yes, if it runs on a server inside tmux. Start a session with tmux new -A -s main, launch claude in it and disconnect; the process keeps running and you can reattach later. tmux sessions survive disconnects but not a restart or redeploy of the box, and a redeploy also stops a running agent turn.

How much does a cloud dev box cost on Railway?

Railway bills usage. For the Ubuntu dev box template, an idle box was measured at about 0.13 GB of RAM, which the template's spec prices at about $1.5 per month with a 1 GB volume. Its estimates are about $12 per month for one agent a few hours a day and about $40 per month for 2-3 agents around the clock. Model usage is billed separately by Anthropic, OpenAI or whichever provider you use.

Can I use my Claude subscription on the box?

The template documents three ways to sign in: run claude and complete the login URL, set ANTHROPIC_API_KEY, or set a CLAUDE_CODE_OAUTH_TOKEN created with claude setup-token. Claude Code is proprietary software installed unmodified and used under Anthropic's terms, so check those terms for your plan.

Is the dev box safe to leave on the internet?

The web terminal and status page sit behind a generated password, and SSH uses a generated password you can replace with a public key. Treat the box as powerful: it has passwordless sudo and holds your logins. Use a key-only SSH setup, keep passwords private, and do not share shell access with others, which Railway's Fair Use Policy also rules out.

Is this for teams?

These templates are single-user machines on one volume, so keep one replica. For a team, deploy one box per person.