A tiny Linux-like VM, in the browser and in Node
Not a Linux distro. No WASM. Just Linux/POSIX APIs, reimplemented in pure TypeScript.
A sandboxed OS for AI agents — a real filesystem, a bash-like shell, Node.js, and npm — that boots in under a millisecond. Runs Vite, Expo, and Supabase unmodified. No Docker, no cloud, no setup.
npx lifo-shWatch
Lifo in 3 minutes
Benchmarks
0.3 MB. Boots in under a millisecond.
The same Lifo VM as a Node process, a single binary, or in a browser tab — next to a browser VM (WebContainers). Both ship node + npm by default.
Cold start & footprint · lower is better
Cold start (green) and footprint (blue) use independent linear scales (axes: 250 ms · 90 MB) — the number is the measurement, the bar length is illustrative. WebContainers' ~6.6 s boot runs off the ms axis with a torn end; its ~75-85 MB wasm-Node engine is the longest footprint bar, next to Lifo's self-contained 59 MB binary and 0.3 MB core.
Measured in the same headless Chromium (methodology). WebContainers runs a wasm build of the real Node engine (fuller, heavier); Lifo reimplements the OS and Node APIs in TypeScript (smaller, a compat subset) — so read this as fit, not a scoreboard.
Architecture
A whole OS in a browser tab
The Sandbox API drives a Linux-like kernel — a shell, coreutils, a Node.js compatibility layer, and a package manager — on a virtual filesystem and network, all inside one tab. A service worker turns in-VM ports into live previews. It's all pure TypeScript — Linux and POSIX APIs mapped onto JavaScript, with no WASM, no emulator, and no native binaries.
Sandbox API
Drive it from your code
A headless Sandbox gives you a filesystem, a shell, and Node.js as plain async calls — ideal for running and inspecting AI-generated code, building tutorials, or powering a browser IDE.
import { Sandbox } from '@lifo-sh/core'
// A whole OS in a variable — no server, no setup.
const sandbox = await Sandbox.create()
const { stdout } = await sandbox.commands.run('echo "hello from Lifo"')
await sandbox.fs.writeFile('/home/user/app.js', 'console.log(42)')
await sandbox.commands.run('node /home/user/app.js')
// npm works — from the real registry.
await sandbox.commands.run('npm i -g cowsay && cowsay hi')Real projects
Runs real stacks, unmodified
Not toys — the actual CLIs and dev servers, running in the tab with their own npm installs.


Capabilities
What's in the box
Virtual filesystem
A real POSIX-like FS with permissions, symlinks, and pipes — persisted to IndexedDB so sessions survive reloads.
Bash-like shell
Pipes, redirection, globbing, variables, subshells, job control, and scripts — a shell that behaves like the one you know.
60+ Unix commands
ls, grep, sed, awk, find, tar, git, curl and more — real implementations, not stubs.
Node.js compatibility
http, fs, net, child_process, streams, crypto… enough that real CLIs and dev servers run unmodified.
Real npm & npx
Install packages straight from the npm registry and run their binaries — inside the tab.
Live previews
A service worker turns in-VM ports into real URLs, so dev servers render in an embedded browser with HMR — with a blob + postMessage fallback for browsers with incomplete service-worker support (e.g. some iOS).
AI-agent sandboxing
Run agent-generated code safely on the user's machine — no VM, no cloud sandbox, no setup.
Boots in milliseconds, $0 infra
~27 ms to a ready box in a browser tab, ~0.5 ms headless in Node. No server to provision, so it scales for free.
Open source (MIT)
The kernel, shell, and node-compat layer are open — build on them, or embed the whole thing.
How Lifo Compares
| Feature | Lifo | WebContainers (browser) | Cloudflare Sandbox | Vercel Sandbox |
|---|---|---|---|---|
| Runs in | Browser tab or Node | Browser only | Container on edge | Cloud microVM |
| Cold boot | ~0.5 ms (Node) · ~27 ms (browser) | ~6.6 s | ~hundreds of ms | ~hundreds of ms – s |
| Download footprint | 0.3 MB (gzipped) | ~75-85 MB runtime | — (server-side) | — (server-side) |
| Special browser headers | None | COOP/COEP required | n/a | n/a |
| Cost / infra | $0, none | Commercial license | Per-request pricing | Per-use, provisioned |
| Isolation | JS-level (not a boundary) | JS-level (browser) | Container / VM | microVM (real) |
| Node / runtime fidelity | Compat subset | Near-full Node | Workers API | Full Linux + native |
| Offline | Yes | No | No | No |
| License | MIT (open source) | Proprietary (commercial license) | Proprietary SaaS | Proprietary SaaS |
| Best for | AI sandboxing, browser IDEs, previews, teaching | Browser IDEs, tutorials | Edge compute, API workers | Real isolation, full Linux |
Not an apples-to-apples race. WebContainers embeds a wasm build of the real Node engine — a fuller, heavier runtime. Lifo is a clean-room reimplementation of the OS and Node APIs in TypeScript: far smaller and faster to boot, but a compat subset rather than the real thing. Read these numbers as fit for a use case (AI sandboxes, browser IDEs, previews, teaching) rather than a scoreboard.
Boot times for Lifo and WebContainers were measured in the same headless Chromium — methodology & numbers.
The spectrum
Where Lifo sits among cloud sandboxes
Server-side microVMs boot fast and give you real isolation — but they run on provisioned, paid infra. Lifo trades that boundary for zero infra and instant boot, and runs the same VM either in a browser tab or in your own Node process (server-side too).
Cold start to a ready box · lower is better
Axis capped at 1.5 s; the WebContainers browser VM tears off the end. * server-side figures are published / typical numbers — they exclude your network round-trip and are not measured in our harness.
| Sandbox | Runs where | Cold start | Isolation | Footprint |
|---|---|---|---|---|
| Lifo (Node) | Your Node process | ~0.5 ms | JS-level (not a boundary) | 0.3 MB |
| Lifo (browser) | Browser tab | ~27 ms | JS-level (not a boundary) | 0.3 MB |
| Lifo (binary) | Any host, single file | ~41 ms | JS-level (not a boundary) | 59 MB |
| Firecracker microVM | Server host | ~125 ms* | microVM (real) | — |
| E2B | Cloud (Firecracker) | ~150-300 ms* | microVM (real) | — |
| Fly.io Machines | Cloud (Firecracker) | ~0.3-3 s* | microVM (real) | — |
| Vercel Sandbox | Cloud microVM | ~hundreds ms-s* | microVM (real) | — |
| WebContainers | Browser tab | ~6.6 s | JS-level (browser) | ~75-85 MB |
Cloud microVMs (Firecracker, E2B, Fly.io, Vercel Sandbox) are a different category: real isolation and full Linux, at the cost of provisioned infra, per-use pricing, and a network hop. Pick them when you need a real boundary; pick Lifo for zero-infra, instant-boot sandboxes — in the browser or on your own server (Node).
Roadmap
Where Lifo is headed
Browser + Node benchmarks, a Node binary that isolates VMs on the host, and tunnelling to use Lifo in place of Docker for dev sandboxes.