mvm-sdk
v0.1.2
Published
Declarative microVM workloads for TypeScript — author once, emit a Nix flake, boot under mvm.
Maintainers
Readme
mvm-sdk — TypeScript SDK
Declarative microVM workloads for TypeScript. Decorate a function or describe
a workload, and the mvmforge host CLI emits a Nix flake plus a launch plan
that mvm can boot.
npm install mvm-sdk
# or: pnpm add mvm-sdk | yarn add mvm-sdkThe host CLI (mvmforge, written in Rust) is distributed separately. The
TypeScript SDK ships only the authoring + runtime surfaces that the host
subprocesses to.
Runs on Node 22.6+ via --experimental-strip-types — no compile step. Node
22.18+ enables type stripping by default (no flag needed).
Quick start
// app.ts
import * as mv from "mvm-sdk";
export const add = mv.func(
{
name: "adder",
image: mv.nixPackages(["nodejs_22"]),
resources: mv.resources({ cpuCores: 1, memoryMb: 256, rootfsSizeMb: 512 }),
},
function add(a: number, b: number) {
return a + b;
},
);mvmforge emit app.ts # canonical IR
mvmforge compile app.ts # flake.nix + launch.json
mvmforge up app.ts # boot under mvm (dev only)Three surfaces
| Surface | Purpose |
| --- | --- |
| Authoring | mv.app({...}), mv.func({...}, fn), mv.workload({...}), factories for image / network / resources / deps. |
| Runtime | f.remote(...) and mv.session(...) — host-side calls into a function-entrypoint VM. Dev-only by design. |
| Sandbox | mv.Sandbox, Process, FileEntry — typed lifecycle handles over local mvm sandbox primitives. Dev-only. |
The runtime SDK exists to assist build-time emission and dev-time
introspection. Production microVMs are observed via mvmctl logs and output
streams; no host-side .remote() calls.
Optional peer deps
npm install zod zod-to-json-schema # for mv.zodSchema(...)
npm install @msgpack/msgpack # for format: "msgpack"Documentation
Full documentation: https://mvmforge-docs.pages.dev/sdks/typescript/
License
Apache-2.0
