Documentation

JavaScript / TypeScript quickstart

Use the same SDK from JavaScript or TypeScript on the server. Use the latest Node.js 26 release, or Node.js 24 LTS. See the Node.js downloads. Pick the language the examples are shown in:

1. Install

Terminal shell
npm init -y
npm pkg set type=module
npm install github:boltzlabs/javascript-sdk

For an existing project, skip npm init. Setting "type": "module" in package.json enables ES imports and top-level await in .js and .ts files.

2. Add your API key

Create an API key in your dashboard. The SDK reads it from the environment or the nearest .env file at or above your current directory.

.env shell
BOLTZLABS_API_KEY=ak_your_key_here

Requests use https://boltzlabs.cloud by default. Keep your key in server code.

3. Run your first task

main.js
import { Sandbox } from 'boltzlabs';

await Sandbox.withSandbox({ environment: 'node' }, async (sandbox) => {
  await sandbox.waitUntilRunning();
  const result = await sandbox.exec('node -e "console.log(1 + 1)"');
  console.log(String(result));
});
Terminal shell
node main.js

withSandbox deletes the sandbox when the callback ends, including when it throws.

Run code without a persistent sandbox

run.js
import { execute } from 'boltzlabs';

const result = await execute('console.log(40 + 2)', { language: 'node' });
console.log(String(result)); // 42

Continue with Sandboxes or Run code.