A full computer on demand
Railway Sandboxes are full Linux VMs you create in code. Wire one into your project's private network, checkpoint it, fork it, and throw it away. Just pay for what it uses, not how long it exists.
Available on every plan. CLI, TypeScript SDK, dashboard, and API.
import { Sandbox } from "railway";
const sandbox = await Sandbox.create({
networkIsolation: "PRIVATE", // reach postgres.railway.internal
});
await sandbox.exec("git clone https://github.com/you/app /app");
await sandbox.exec("npm ci", { cwd: "/app" });
await sandbox.checkpoint("app-ready");
const fork = await sandbox.fork();
const { exitCode, stdout } = await fork.exec("npm test", { cwd: "/app" });
await Promise.all([sandbox.destroy(), fork.destroy()]);Useful right when you provision
Claude Code, Codex, and other coding agents come preinstalled, along with Node.js and Git. Start running commands as soon as your sandbox is ready, with your databases and services on the same private network when you need them. Read the guide →
From provision to first command
Railway's base image includes Claude Code, Codex, and other coding agents, along with Node.js and Git. The other-provider path shows the setup steps needed when these tools aren't included in the image.
Reach your sandbox
by web, Android, iOS, or SSH
Watch your sandboxes list from code, or step in yourself with Railway's unrivaled developer experience. Dashboard docs →
provisions
and counting
Everything a sandbox needs,
in the SDK and the CLI
Priced for how agents
actually work
A sandbox bills per second for the CPU it actually uses and the memory it holds. See all pricing →
Memory
$0.001157 per GB-minute
CPU
$0.001157 per vCPU-minute
Egress
$0.05 per GB
One run of
Code review on every PR
8 min · 1 GB · 25% of a vCPU busy
$0.01
Sandbox usage draws from the same included credit and usage limits as your services. Destroyed sandboxes cost nothing. Per-plan limits are on the pricing page.
What is a Railway sandbox?
An isolated Linux VM you create through the TypeScript SDK, CLI, or dashboard. Git, Node.js, and coding agents are already installed, so you can start running commands and working with files right away.
How is a sandbox different from a service?
A service runs your deployed app, API, or worker. A sandbox gives your application a VM for a task, like running an agent or testing a change. Your code decides when to create it, what to save, and when to destroy it.
How much does a sandbox cost?
CPU and memory usage are billed per second, at $50/vCPU-month and $50/GB-month. Outbound traffic costs $0.05/GB. For example, a 20-minute task averaging 1 GB of memory and 30% of a vCPU costs about $0.03, plus outbound traffic.
Do I pay for an idle sandbox?
Yes. It still uses memory, and background work can use CPU and bandwidth. Sandboxes have an idle timeout by default, though running commands or active sessions can keep them alive. Destroy yours when you're done to stop compute charges.
Can a sandbox reach my database?
Yes. Set networking to PRIVATE and pass in your database credentials. Your sandbox can then connect to databases and services in the same environment. The default setting, ISOLATED, only allows outbound internet access.
What are checkpoints, forks, and templates?
A checkpoint saves a sandbox's disk so you can start from it later, even after deleting the original. A fork creates another sandbox from a running one's files. A template lets you reuse a setup, with builds cached for next time. Each new sandbox boots fresh; processes and memory aren't copied.
Which plans include sandboxes?
All of them, including Free and Trial. Your plan determines how many sandboxes you can run in each environment, their CPU and memory limits, and idle timeout options. Usage counts toward your plan's included credit.
Can my sandbox have a public URL?
Yes. Choose PRIVATE networking and request a domain when you create it. You can have up to 10 domains, each pointing to a different port. They're removed when you destroy the sandbox.