A code execution service that can run arbitrary code snippets in ephemeral Docker containers. Submit code in a supported language via HTTP and get back streaming stdout/stderr/result output. Supports one-off execution and persistent named functions with pre-built images. See /demo folder for a demo application.
docker compose upThis starts a Redis-compatible store (Valkey), the tinirun server on port 8080, and a demo web UI on port 3000. The default API key is api-key-123.
API docs are available at http://localhost:8080/api/docs.
All server config uses environment variables prefixed with RUNNER_:
| Variable | Required | Default | Description |
|---|---|---|---|
RUNNER_REDIS_URL |
Yes | — | Redis connection URL |
RUNNER_API_KEY |
Yes | — | API key for X-Runner-Api-Key header |
RUNNER_HOST |
No | 127.0.0.1 |
Bind address |
RUNNER_PORT |
No | 8082 |
Bind port |
RUNNER_LOG_LEVEL |
No | warn |
Log level (trace, debug, info, warn, error) |
RUNNER_CLEANUP_INTERVAL |
No | 300 |
Seconds between Docker image cleanup runs |
Docker connectivity uses standard Docker SDK environment variables (DOCKER_HOST, DOCKER_TLS_VERIFY, etc.).
All API routes require the X-Runner-Api-Key header.
POST /api/code/run — Run a one-off code snippet.
Request body:
{
"code": "print('hello')",
"lang": "python",
"dependencies": [],
"files": [],
"timeout": 60,
"mem_limit_mb": 256,
"cpu_limit": 0.5
}Supported languages: bash, go, javascript, python, rust, typescript
See OpenAPI docs for creating and running persisted functions.
GET /api/openapi.json — OpenAPI spec (no auth required)
GET /api/docs — Swagger UI (no auth required)
Streaming endpoints return NDJSON (one JSON object per line). Pass Accept: text/event-stream to receive Server-Sent Events instead.
{"event":"info","data":"Checking base image..."}
{"event":"stdout","data":"Hello World\n"}
{"event":"result","data":{"stdout":"Hello World\n","stderr":"","exit_code":0,"timeout":false}}
Event types: info, stdout, stderr, result, error
Generated Node.js and Rust clients are available in the /clients folder.
cargo run -p tinirun-serverpnpm install
cd demo && pnpm devSet DEMO_TINIRUN_URL and DEMO_TINIRUN_API_KEY for the demo to connect to the server.