JavaScript quickstart¶
1. Install¶
2. Set your key¶
3. Run code¶
import { Sandbox } from "@sistemo/sdk";
const sb = await Sandbox.create();
const r = await sb.run("echo hello from a microVM");
console.log(r.stdout); // "hello from a microVM\n"
console.log(r.exitCode); // 0
await sb.close();
4. Several commands in one sandbox¶
const sb = await Sandbox.create({ stack: "node" });
try {
await sb.run("npm init -y");
const r = await sb.run("node -e 'console.log(process.version)'");
console.log(r.stdout);
} finally {
await sb.close(); // always clean up
}
5. Pick an image and size¶
const sb = await Sandbox.create({
stack: "python", // base | python | node | debian13 | ubuntu24.04
vcpus: 2,
memoryMb: 2048,
rootfsSizeGb: 20,
});
Always close
There's no using cleanup by default โ wrap usage in try/finally and call await sb.close() so a crash doesn't leak a billing sandbox.
Next: Sandbox API ยท Examples