@computesdk/railway
v1.2.2
Published
Railway provider for ComputeSDK - simple cloud deployment for containerized sandboxes
Maintainers
Readme
@computesdk/railway
Railway provider for ComputeSDK that enables creating and managing containerized sandboxes on Railway's infrastructure.
Installation
npm install @computesdk/railwayConfiguration
The Railway provider requires the following environment variables:
RAILWAY_API_KEY=your_railway_api_key
RAILWAY_PROJECT_ID=your_railway_project_id
RAILWAY_ENVIRONMENT_ID=your_railway_environment_idQuick Start
Gateway Mode (Recommended)
Use the gateway for zero-config auto-detection:
import { compute } from 'computesdk';
// Auto-detects Railway from RAILWAY_API_KEY/RAILWAY_PROJECT_ID/RAILWAY_ENVIRONMENT_ID environment variables
const sandbox = await compute.sandbox.create();
console.log(`Created sandbox: ${sandbox.sandboxId}`);
await sandbox.destroy();Direct Mode
For direct SDK usage without the gateway:
import { railway } from '@computesdk/railway';
const compute = railway({
apiKey: process.env.RAILWAY_API_KEY,
projectId: process.env.RAILWAY_PROJECT_ID,
environmentId: process.env.RAILWAY_ENVIRONMENT_ID
});
const sandbox = await compute.sandbox.create();
console.log(`Created sandbox: ${sandbox.sandboxId}`);
await sandbox.destroy();Currently Implemented
Sandbox Operations
- create() - Creates a new Railway service with Docker container deployment
- destroy() - Deletes a Railway service
Supported Runtimes
- node - Uses
node:alpineDocker image - python - Uses
python:alpineDocker image (default)
Configuration Options
- apiKey - Railway API authentication token
- projectId - Railway project identifier
- environmentId - Railway environment identifier
Notes
- Services are automatically deployed upon creation
- Service names are generated with timestamp:
sandbox-{timestamp} - All operations use Railway's GraphQL API
- Environment variables take precedence over config options
