POSIX & WASI browser kernel · @waffle-os/runtime

A POSIX kernel builtnatively for WebAssembly.

Waffle gives WebAssembly programs a shared filesystem, real processes, pipes, Unix sockets, PTYs, and loopback TCP inside one browser tab. 18.7 KB gzipped core, zero CPU emulation.

bash-webpid 1demo session

Process table

Running
1
Pipes open
0
Files
0
Spawned
1

Architecture

Native WebAssembly speed without a CPU emulator.

Compiling Linux to Wasm and emulating ARM64 on top takes a ~10 MB browser boot with Alpine and runs user code behind an interpreter or JIT. Waffle builds the kernel directly for WebAssembly so every tool executes on V8, SpiderMonkey, or JavaScriptCore at full engine speed.

ApproachKernelUser spaceDownloadExecution cost
Whole-machine emulators (v86, QEMU)Linux, emulatedUnmodified x86/ARM, emulated10+ MBEmulated kernel and user CPU
Linux-in-Wasm + CPU emulator (unkernel)Linux, native WasmARM64 binaries, emulated + JIT~10 MB (kernel + Alpine)Fast syscalls, emulated user compute
Per-tool WASI shimsNoneIsolated WASI modulesPer-tool shim onlyNative Wasm, no shared OS state
WaffleNative browser OS kernelNative Wasm / WASI userland18.7 KB core (+151 KB VFS)Native browser Wasm speed, zero CPU emulation

Kernel subsystems

One runtime per tab. Every service loads on first use.

The page owns one runtime instance. Shells, language runtimes, and Unix utilities borrow its filesystem, process table, pipes, sockets, and network instead of shipping separate sandboxes.

Detail Apids · signals · pty

Real processes, signals, and PTYs

Every command runs in its own worker with a real PID, job ID, Linux signals, cooperative Wasm interrupt rewriting, guest PTYs, WASI threads, and shared-memory groups.

Detail Bsab · multi-tab · locks

Shared-memory VFS and multi-tab storage

Lazy 16 MiB shared segments backed by memory, IndexedDB, or internal OPFS, with multi-tab leader failover, durable write receipts, recursive watches, POSIX modes, lossless byte filenames, and flock/fcntl locks on exclusive backends.

Detail C64 kib rings · af_unix

Synchronous pipes and Unix sockets

64 KiB shared-memory pipe rings plus pathname and abstract AF_UNIX sockets. Guest workers block on Atomics.wait so unmodified Preview 1 programs using supported imports run without JSPI.

Detail Drust wasm · preview sw

Loopback TCP, previews, and relay

A lazy Rust wasm32 TCP stack serves 127.0.0.1 inside the tab, a Service Worker preview router connects browser frames to guest servers, and @waffle-os/relay adds opt-in outbound TCP.

The API

Zero manual worker imports.

Enable the Vite plugin for automatic COOP/COEP headers and WebKit-safe single-file workers, create one runtime, and run WASI commands with runtime.run(). Non-Vite bundlers import explicit worker entries from @waffle-os/runtime/workers/*.

bun add @waffle-os/runtime @waffle-os/base

Read getting started

app.ts
import { createRuntime } from "@waffle-os/runtime";

const runtime = createRuntime();
try {
  await runtime.filesystem.writeFile("/hello.txt", "hello from Waffle");
  const bytes = await runtime.filesystem.readFile("/hello.txt");
  document.body.textContent = new TextDecoder().decode(bytes);
} finally {
  await runtime.dispose();
}
WASI core gzipped (bun run size)
18.7 KB
64 B pipe roundtrip
1.6 μs
VFS readFile / writeFile (20 B)
1.5 / 4.9 μs
Minimal WASI _start lifecycle
199 μs

Measured 2026-11-29 on Bun 1.4.4 (Linux x64); timings are in-process Bun microbenchmarks. Shared VFS worker is 151.5 KB gzip and preview service worker is 1.4 KB gzip; process supervisor (103.4 KB gzip), Rust network module (≤ 28 KB gzip), and GPU bridge (4.8 KB display gzip) load lazily on first use.

Upstream userland & ecosystem

Real Unix programs compiled to WASI.

@waffle-os/base bundles 35 permissive MIT and BSD utilities. Heavyweight runtimes and copyleft packages stay opt-in behind an automated SPDX and source-first provenance gate.

19 packages

Status & roadmap

What ships today, and what comes next.

Waffle is pre-1.0 software published on npm. Every shipped capability below is backed by automated unit, conformance, or 3-engine Playwright tests.

Shipped today

Production-tested browser kernel

  • Published on npm as @waffle-os/runtime with 19 public entry points and Vite plugin
  • Shared-memory VFS with memory, IndexedDB, internal OPFS, and multi-tab attach failover
  • Rooted atomic edits, durable write receipts, recursive watches, POSIX modes, lossless byte filenames, and flock/fcntl locks
  • Processes, jobs, signals, Wasm interrupt rewriting, 64 KiB pipes, AF_UNIX sockets, and guest PTYs
  • Lazy Rust wasm32 loopback TCP, Service Worker previews, @waffle-os/relay, and WebGPU display bridge
  • Experimental WASI threads (9/9 passing on desktop Safari and iPhone Simulator Safari), memory groups, and dynamic linking
  • 16 verified packages with automated SPDX license closure and source-first release gates

Planned and upcoming

Next kernel milestones

Wafflify (POSIX fork() via cloneable Wasm continuations)
A standalone Rust Wasm pass on stock Clang and standard Wasm Exception Handling, paired with a zero-copy posix_spawn() fast path, to run unmodified GNU Bash 5.2/5.3, upstream C Git, and CPython os.fork().
JSPI suspension paths
Optional WebAssembly.Suspending support alongside the universal Atomics.wait worker path. probeRuntimeSupport() on @waffle-os/runtime already probes JSPI availability.
SAFE synchronous-durability VFS mode
Durable-ACK storage mode where every mutation commits before returning. mode: "safe" is reserved and throws UNSUPPORTED_VFS today.