Back to Projects

Code Playground API

Sandboxed TypeScript code execution environment. Run code snippets safely with timeout protection and output capture.

Endpoint

POST/api/run

Execute TypeScript code in a secure sandbox with a 5-second timeout.

Request Body

codestring (required)TypeScript code to execute. Max 1000 characters.
timeoutnumber (optional)Custom timeout in ms (default: 5000, max: 5000)

Response Schema

outputstringCaptured stdout from code execution
errorstring | nullError message if execution failed
executionTimenumber (ms)How long the code took to execute
timedOutbooleanWhether execution was terminated due to timeout

๐Ÿงช Try It Live

Write TypeScript code and execute it on our Bun-powered server.

Output:

// Output will appear here...

๐Ÿ”’ Security: Code runs in a sandboxed environment. The following APIs are blocked:

fetch require import eval Function process Bun.file Bun.write

Example Request

curl -X POST https://beanola.com/api/run \
  -H "Content-Type: application/json" \
  -d '{"code": "console.log(\"Hello!\")"}'

Example Response

{
  "output": "Hello!\n",
  "error": null,
  "executionTime": 12.5,
  "timedOut": false
}