Skip to content

Repository files navigation

napi-vm

A sandboxed JavaScript virtual machine written in Rust with Node.js NAPI and WebAssembly integrations. It includes a shared language service, browser playground, local LSP, optional Zed extension, live VM metadata, and an IPC-style command/event bridge for deterministic tests.

Quick start

npm install
npm run build
npm test
const { Vm } = require("./index.js");

const vm = new Vm();
vm.run("let answer = 40 + 2;");
console.log(vm.run("answer;")); // 42

Documentation

  • Getting started — installation, VM usage, host bridge, modules, and playground
  • API referenceVm, LanguageService, and VmSession
  • Editor integration — playground, LSP, Zed, live metadata, and IPC commands
  • Sandbox safety — containment guards and operational limits
  • Development — quality gate, scripts, benchmarks, and project structure
  • Roadmap — implemented features and known boundaries

Useful examples

bun examples/hotreload.ts
NAPI_VM_SESSION=1 bun examples/hotreload.ts
npm run ipc:smoke

The first command runs the VM entirely in-process. The second opt-in command publishes live metadata for the LSP through .napi-vm/runtime.json; the temporary locator is ignored and removed when the session stops.

Status

The core language and bridge are actively developed and covered by the native regression suite. Run npm test to see the current verified count.

License

No license specified.

About

A sandboxed JavaScript virtual machine built from scratch in Rust

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages