bashkit

Get started in Node, Bun & Deno#

Embed the Bashkit sandbox in a server-side JavaScript or TypeScript runtime. @everruns/bashkit is a NAPI native addon — the fastest JS binding — for Node (≥ 18), Bun, and Deno. For browsers and edge runtimes, use Get started in the browser instead.

Install#

npm i @everruns/bashkit

First script#

import { Bash } from "@everruns/bashkit";

const bash = new Bash();
const result = bash.executeSync('echo "Hello, World!"');
console.log(result.stdout);

Persistent state#

A Bash instance keeps its environment and virtual filesystem across calls:

const bash = new Bash();
bash.executeSync("X=42");
console.log(bash.executeSync("echo $X").stdout); // 42

Sandbox options#

Pass resource limits, identity, and seed files to the constructor:

const bash = new Bash({
  cwd: "/home/agent",
  env: { HOME: "/home/agent" },
  maxCommands: 1000,
  maxLoopIterations: 10000,
  maxMemory: 64 * 1024 * 1024,
});

See Sandbox configuration & limits for the full set.

Examples#

Runnable Node examples in the repo:

Next steps#