Deploy Sandbox
Create sandboxes on Railway with ComputeSDK.
Compute Sandbox
Just deployed
Deploy and Host Sandboxes on Railway
Use Railway as a sandbox provider for executing AI-generated code. This ComputeSDK template deploys a binary that exposes Railway as a sandbox backend, allowing you to self-host code execution environments—giving you cost-effective sandbox infrastructure.
About Hosting Sandboxes on Railway (Self Hosting Sandboxes on Railway)
This template converts Railway into a full-featured sandbox provider for running AI-generated code. Instead of relying solely on third-party providers, you run your own sandbox execution environment on Railway's platform. The ComputeSDK binary handles sandbox lifecycle management, code execution, file system operations, and resource isolation. This means your applications continue using ComputeSDK as the orchestration layer, but now Railway is one of your available backends for executing untrusted code securely.
Common Use Cases
- Cost-Optimized Execution - Run high-volume code execution workloads on Railway's predictable pricing instead of paying per-execution to managed providers
- Self-Hosted Sandbox Infrastructure - Maintain full control over your execution environment, data locality, and compliance requirements while still using ComputeSDK's unified API
- Hybrid Multi-Provider Setup - Use Railway for general workloads and specialized tasks (like GPU-heavy operations), all orchestrated through ComputeSDK
- Development & Testing - Spin up your own sandbox environment for development
- Enterprise Isolation - Deploy dedicated sandbox infrastructure for enterprise customers who require complete data isolation and custom security policies
Dependencies for Railway Sandbox Provider
- Railway Account - Active Railway account with sufficient resources for your workload
- ComputeSDK - Install
computesdkin your application - Docker (handled by Railway) - The binary runs in Railway's containerized environment
- Resource Allocation - Adequate CPU/memory limits configured in Railway based on expected sandbox usage
Deployment Dependencies
- ComputeSDK API Key - Required to create sandboxes with Railway
- RAILWAY_API_KEY
- RAILWAY_PROJECT_ID
- RAILWAY_ENVIRONMENT_ID
- ComputeSDK Documentation
- Railway Sandbox Provider Package
- Railway Documentation
- GitHub Repository
Implementation Details
Once deployed, integrate Railway as a provider in your ComputeSDK application:
import { compute } from 'computesdk';
// Create a new sandbox
// Auto-detects from environment variables
const sandbox = await compute.sandbox.create();
console.log(`Sandbox created: ${sandbox.sandboxId}`);
// Get sandbox info
const info = await sandbox.getInfo();
console.log(`Sandbox status: ${info.status}`);
// Clean up when done
await sandbox.destroy();
Why Deploy Sandboxes on Railway?
Railway is a singular platform to deploy your infrastructure stack. Railway will host your sandbox infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.
By deploying the Railway Sandbox Provider on Railway, you get:
- Own Your Sandbox Infrastructure - Deploy a self-hosted sandbox provider that you control, reducing dependency on external services while maintaining ComputeSDK's unified interface
- Predictable Costs at Scale - Pay for Railway's flat-rate compute resources instead of per-execution fees, making high-volume code execution economically viable
- One-Click Deployment - This template configures everything needed to run the sandbox binary—no complex Docker setups or security configurations required
- Seamless Integration - Works as a drop-in provider alongside E2B, Vercel, and Daytona in your existing ComputeSDK applications
- Vertical Scaling - Adjust CPU and memory allocation in Railway's dashboard to handle more complex or resource-intensive code execution
Host your complete application stack on Railway: your frontend, APIs, databases, and now your sandbox execution infrastructure—all managed through ComputeSDK's orchestration layer with minimal operational complexity.
Template Content
Compute Sandbox
computesdk/compute
