Documentation Index
Fetch the complete documentation index at: https://docs.stacyide.xyz/llms.txt
Use this file to discover all available pages before exploring further.
This example uses the TypeScript SDK to build a small HTTP API. Each request gets a fresh sandbox, writes submitted code to /app/main.js, runs it with Node.js, returns the result, and destroys the sandbox.
Prerequisites
- Node.js 18+.
- A running StacyVM server.
- Docker provider access on the StacyVM host.
- A StacyVM API key if auth is enabled.
The source lives in examples/code-runner-typescript.
Install
cd examples/code-runner-typescript
npm install
export STACYVM_URL="http://localhost:7423"
export STACYVM_API_KEY="sk_test_YOUR_API_KEY"
export STACYVM_IMAGE="node:20"
Run The App
Submit Code
curl -sS -X POST http://localhost:8081/run-javascript \
-H "Content-Type: application/json" \
-d '{"code":"console.log([10, 20, 12].reduce((a, b) => a + b, 0));","timeout":"10s"}'
Response
{
"exit_code": 0,
"stdout": "42\n",
"stderr": "",
"duration": "120ms"
}
Production Notes
Before exposing this service, add authentication, request size limits, per-user quota attribution, audit logging, and host runtime certification.