Skip to main content
Get Started
Getting Started

Quickstart

Get Secure Exec running in a few minutes.

  1. Install

  2. Create a runtime

    NodeRuntime.create() boots a fully virtualized VM behind the native sidecar. Guest code runs inside the kernel isolation boundary with no host escapes. All options are optional: cwd defaults to /workspace, and permissions default to a secure policy that denies network access (see step 4).

    import { NodeRuntime } from "secure-exec";
    
    const runtime = await NodeRuntime.create();
    
  3. Run code

    Use run() when you want a JSON value back; the guest calls globalThis.__return(value) to set it. Use exec() when you care about side effects and want to capture stdout/stderr/exitCode. Guest code runs as an ES module, so import and top-level await both work.

    See Full Example

  4. Configure permissions (optional)

    Guest code is deny-by-default for network access. Pass a permissions policy to NodeRuntime.create() to opt in; it merges over the secure default, so you only specify what you want to change:

    const runtime = await NodeRuntime.create({
      permissions: { network: "allow" },
    });
    

    See Permissions for the full scope list and merge semantics.

Next steps