Skip to content

Node.js SDK

The TypeScript SDK currently exposes both runtime and declarative surfaces.

Current:

  • Sandbox.create(template, options)
  • sandbox.commands.start(argv, options)
  • sandbox.files.write(path, content)
  • using cleanup through Symbol.dispose
  • record mode for plan/build flows;
  • live mode through mvmctl run --mode live

Planned:

  • command result capture through commands.run(...);
  • file read/list/remove;
  • logs and event streams;
  • port helpers;
  • snapshot, cold, resume, detach, destroy;
  • additional lifecycle result types once the local runtime transport supports them.
import * as mvm from "mvm-sdk";
export const worker = mvm.app({
image: mvm.nix_packages(["nodejs_22"]),
resources: mvm.resources({ cpu_cores: 1, memory_mb: 512 }),
network: mvm.network({ mode: "deny" }),
})((input: string): string => input.toUpperCase());

The AST compiler accepts the supported literal declaration shape and lowers it into Workload IR.

  • Runtime scripts execute host-side SDK code.
  • Prefer static declarations for deployable workloads.
  • Do not place raw credentials in source examples.
  • Keep egress explicit and narrow.

See Runtime modes before using live mode in automation. See Operations cookbook for current calls, target helpers, and CLI fallbacks.