railway-sandbox
Railway Sandboxes with ComputeSDK
Self-host sandbox environments on Railway's infrastructure through ComputeSDK's unified API. Railway provides instant deployments with automatic SSL — ideal for self-hosted sandbox environments, persistent services, and containerized development.
Prerequisites
Before using Railway as a provider, deploy the ComputeSDK sandbox template to your Railway account (one-time setup):
This deploys a lightweight binary that converts Railway into a sandbox provider.
Setup
npm install computesdk
# .env
COMPUTESDK_API_KEY=your_computesdk_api_key
RAILWAY_API_KEY=your_railway_api_key
RAILWAY_PROJECT_ID=your_railway_project_id
RAILWAY_ENVIRONMENT_ID=your_railway_environment_id
Get your ComputeSDK key at https://console.computesdk.com/register
Getting Railway Credentials
- API Token: Railway workspace settings -> Tokens -> New Token
- Project ID: Project -> Settings -> Project Info
- Environment ID: Found in the URL:
railway.com/project/{PROJECT_ID}/settings?environmentId=={ENVIRONMENT_ID}
Quick Start
import { compute } from 'computesdk';
// Auto-detects Railway from environment variables
const sandbox = await compute.sandbox.create();
console.log(`Sandbox: ${sandbox.sandboxId}`);
const result = await sandbox.runCode('print("Hello from Railway!")');
console.log(result.output);
await sandbox.destroy();
Explicit Configuration
For multi-provider setups or when you want to be explicit:
import { compute } from 'computesdk';
compute.setConfig({
computesdkApiKey: process.env.COMPUTESDK_API_KEY,
provider: 'railway',
railway: {
apiToken: process.env.RAILWAY_API_KEY,
projectId: process.env.RAILWAY_PROJECT_ID,
environmentId: process.env.RAILWAY_ENVIRONMENT_ID,
}
});
const sandbox = await compute.sandbox.create();
Railway Configuration Options
interface RailwayConfig {
apiToken?: string; // Uses RAILWAY_API_KEY env var if not set
projectId?: string; // Uses RAILWAY_PROJECT_ID env var if not set
environmentId?: string; // Uses RAILWAY_ENVIRONMENT_ID env var if not set
}
Full API
ComputeSDK provides the same API across all providers: filesystem operations, shell commands, managed servers, overlays, terminals, and client access.
Install the main skill for the complete reference:
npx skills add https://github.com/computesdk/sandbox-skills --skill computesdk
More from computesdk/sandbox-skills
e2b-sandbox
Guide for creating and managing E2B sandboxes using ComputeSDK. Use when building applications that need E2B Firecracker microVM sandboxes for secure code execution, AI code runners, or isolated development environments on E2B.
57computesdk
Guide for building sandbox applications with ComputeSDK, a unified TypeScript SDK for running untrusted code in sandboxed environments across multiple compute providers (E2B, Daytona, Vercel, Modal, Railway, Namespace, Render). Use this skill when implementing sandboxed code execution, creating isolated development environments, running LLM-generated code safely, building app builders, or integrating dynamic code execution into applications.
11daytona-sandbox
Guide for creating and managing Daytona sandboxes using ComputeSDK. Use when building applications that need Daytona development workspace environments for code execution, full-featured dev environments, or isolated coding workspaces.
10vercel-sandbox
Guide for creating and managing Vercel sandboxes using ComputeSDK. Use when building applications that need Vercel's globally distributed serverless sandbox environments for code execution with Node.js or Python runtimes.
6render-sandbox
Guide for creating and managing Render sandboxes using ComputeSDK. Use when building applications that need self-hosted sandbox environments on Render's cloud platform for code execution with zero infrastructure setup.
4modal-sandbox
Guide for creating and managing Modal sandboxes using ComputeSDK. Use when building applications that need Modal's GPU-accelerated sandbox environments for machine learning workloads, AI inference, or compute-intensive code execution.
4