ARCHIVE.ZERO
Five exhibits where a real Linux kernel boots inside the browser: Unix tools, a COBOL banking ledger, SQL, HTTP, and an X.Org desktop, with missions validated against the guest's own files, processes and pixels
The Problem
Computing history online is mostly photographs and dates. You read that Unix introduced pipes in 1969 and close the tab with no new ability. The interactive alternatives fail in a specific way: terminal simulators match your keystrokes against a prewritten JavaScript answer key, so the output is canned, the filesystem is imaginary, and nothing a visitor types can be wrong.
Portfolios carry the same gap. Browser projects usually stop at a Canvas game or a CRUD app. Running a kernel, a compiler, or a display server inside a tab is rare enough that most technical readers have never seen it done, and rarer still to see it wrapped in enough historical context that a non-specialist learns something.
What I Built
ARCHIVE.ZERO boots Linux 7.3 compiled to WebAssembly (Unkernel) in a Web Worker, then builds a museum around it. Five exhibits, each with a historical introduction, sourced references, five guided missions, and an offline environment that persists per exhibit in IndexedDB:
-
The Unix Machine (beginner, ~40 min). Five missions over a stock Alpine image: record who you are and where with redirection, move files through a directory tree until the original is gone, grant the execute bit and run a script through the shebang, pull the five most frequent error types out of a generated 200-line log with one pipeline, then start a background
sleep, capture its PID and kill it cleanly. All 22 required tools ship in the image; nothing is installed at runtime. -
The Mainframe Ledger (intermediate, ~50 min). GnuCOBOL compiled by missions, not shown in screenshots: a first
cobc -xprogram, fixed-width customer records read through anFD, a ledger that rejects bad rows withCHECK-style validation (INVALID 2on a feed with two poisoned entries), a 500-row batch whose summary line must readSUMMARY OK=480 FAIL=20 CREDIT=8136000 DEBIT=8160000, and a forensic report naming five deliberately corrupted lines. Datasets are fictional and generated locally on first boot. -
The Birth of the Web (beginner, ~40 min). Hand-write HTML, start
python3 -m http.server, probe it withcurl -sIuntilHTTP/1.0 200lands in a file, then preview the live site in an iframe that reaches the guest’s loopback over vsock. Later missions capture a404, compareGETwithPOST, and ship a two-page site with working relative links. -
The Relational Model (intermediate, ~40 min). SQLite from zero: import a CSV, declare
PRIMARY KEY/NOT NULL/CHECKand watch the engine reject a negative balance, join customers to orders soZENITH TEXTILES|120000ranks first, aggregate twelve rows into five totals withGROUP BY, and export aTOTAL|295000report the validator reads back from disk. -
The Graphical Desktop (intermediate, ~45 min). Start
sudo -n X :0on the guest framebuffer and a white xterm appears on the Screen tab; type a command into that window through the evdev path and the file it writes proves the round trip; addtwmfor title bars; open a second window; repaint the root navy and watch the pixel count flip. No display server runs anywhere except inside the wasm kernel.
The workstation is three panels: a mission sidebar with progressive hints, a tabbed workspace (Terminal, Screen, Preview), and a context panel that shows instructions and runs the completion check. Missions never trust a “mark as done” button. Validation executes probes against the live guest: a file must exist with the right content, cobc must compile and print 42042, pidof twm must succeed, and the GUI missions count framebuffer pixels until an xterm window (or a navy root) actually appears.

How the missions are checked
Representative validators, all executing against the guest rather than a UI flag:
| Exhibit | Mission | What the validator runs |
|---|---|---|
| Unix | The Unix Philosophy | sort -u top-errors.txt | wc -l prints 5, plus five fixed-string content checks |
| Unix | Processes | kill -0 on the recorded PID must fail, and the PID file must be numeric |
| Mainframe | Overnight Batch | cobc -x && ./batch output equals SUMMARY OK=480 FAIL=20 CREDIT=8136000 DEBIT=8160000 |
| Mainframe | Find the Corruption | the report file contains exactly the tokens L07 L19 L33 L44 L61 |
| Web | Your First Web Server | custom check: vm.fetch("http://localhost:8000/") returns 200 with an <h1> in the body |
| Relational | The Join | the .sql file contains JOIN, and executing it prints ZENITH TEXTILES|120000 first |
| Graphical | Start the Display Server | framebuffer read: ≥ 20,000 lit pixels across retried frames |
| Graphical | Paint the Root | ≥ 5,000 blue-dominant pixels after xsetroot -solid navy |
How a check travels from button press to guest state:
flowchart LR
A[Check mission] --> B[validateMission]
B --> C{validation strategy}
C -->|file| D["test -f, grep -qF"]
C -->|command| E[compare exit code]
C -->|output| F[match stdout]
C -->|script| G[execute by path]
C -->|custom| H["vm.fetch, framebuffer pixels"]
D --> I{every check passes}
E --> I
F --> I
G --> I
H --> I
I -->|yes| J[Mark complete in IndexedDB]
I -->|no| K[Report the failing checks]
Architecture
src/features/runtime/ ExhibitRuntime interface; UnkernelRuntime is the
only module importing the SDK
src/features/missions/ validation engine running exec() probes on the
live guest, independent of React
src/features/preview/ service worker relay:
/vm/<id>/<port>/* → page → vm.fetch() → guest loopback
src/features/persistence/ IndexedDB progress store, separate from guest disk
src/content/ eras, timeline, exhibits, missions (zod-validated)
src/app/(museum)/ landing, archive, timeline, about, exhibit detail
src/app/exhibits/… workstation: terminal/preview/screen tabs,
mission sidebar, context panel
public/distro/ alpine.erofs (pinned tag, sha256-verified)
public/exhibits/<slug>/ offline .apk packages per exhibit
Who calls whom at runtime:
graph LR
UI[Workstation UI] --> RT["ExhibitRuntime interface"]
RT --> UN[UnkernelRuntime adapter]
UN --> SDK["unkernel/web"]
SDK --> KW[Linux kernel in a Web Worker]
UI --> ME[Mission engine]
ME --> RT
UI --> PR[Preview relay]
PR -->|vm.fetch over vsock| RT
UI --> PG[Progress store]
PG --> IDB[(IndexedDB)]
Boot sequence, once the visitor presses Launch:
checkSupport()— JSPI, WebAssembly, BigInt; failure renders the SDK’s own diagnostics- Fetch the exhibit’s setup script and
.apkfiles, then stage them as a plain object tree createKernel({ worker: true, display, disks: [{ kind: "data", template: "bundled", name }] })- First boot only: install packages (root), run the setup script (user, so
$HOMEis right), drop a marker file - Console output since boot replays into xterm.js; status flips to ready
- Later boots skip step 4 from the marker; the data disk restores the filesystem
flowchart TD
A[Launch environment] --> B{checkSupport passes}
B -->|JSPI missing| E[Error with the SDK diagnostics]
B -->|ok| C[Stage setup script and apk files]
C --> D["createKernel: worker, distro, data disk, display"]
D --> F{Marker file exists}
F -->|yes, later boots| J[Environment ready]
F -->|no, first boot| G["Install packages as root: apk add or tar"]
G --> H["Run setup.sh as user so HOME is /home/user"]
H --> I[Touch the marker file]
I --> J
J --> K[Terminal replays console output since boot]
The runtime moves through explicit states, so the UI never guesses:
stateDiagram-v2
[*] --> idle
idle --> checking: launch
checking --> downloading
downloading --> booting
booting --> initializing
initializing --> ready
ready --> running: command in flight
running --> ready
ready --> syncing: Save
syncing --> ready
ready --> stopping: Reset
stopping --> stopped
checking --> error: unsupported browser
booting --> error: boot failure
error --> idle: relaunch
stopped --> idle: relaunch
Technical Decisions
- One adapter owns the SDK.
UnkernelRuntimeis the only file that importsunkernel/web. Components speak a smallExhibitRuntimeinterface, so a future engine swap touches one module. - Offline by construction. A Node script fetches Alpine
.apkpackages once; first boot installs them from a 9p mount withapk add --no-network, or straighttarextraction when the closure carries mesa’s 63 MB LLVM compiler that no exhibit ever loads. Guest networking stays disabled in every exhibit. - Persistence in two planes. Guest filesystems live on per-exhibit data disks (
kwdisk:az-<slug>-v1). Mission progress lives in a separate IndexedDB record, so Reset wipes the machine without erasing what you learned. - Preview without a backend. A service worker relays
/vm/<id>/<port>/*requests to the page, which answers withvm.fetch()over vsock. The guest’shttp.serverreaches the iframe with zero public network traffic. - Mission engine as a library. Validation strategies (file, command, output, script, custom) are plain functions over the runtime interface. The UI only renders results, which is why the same checks run headless in Playwright.
- Cross-origin isolation (COOP/COEP) for SharedArrayBuffer, with
checkSupport()gating the launch button on JSPI.
Preview bridge
sequenceDiagram
participant F as Preview iframe
participant S as Service worker
participant P as Page holding the kernel
participant G as Guest port 8000
F->>S: GET /vm/id/8000/
S->>P: relay over a MessagePort
P->>G: HTTP request over vsock
G-->>P: status, headers, body
P-->>S: head, chunks, end
S-->>F: streamed Response
Two-plane persistence
flowchart LR
subgraph guest [Guest]
FS[Root filesystem overlay]
end
subgraph host [Host browser]
DD[(Data disk per exhibit)]
PG[(Progress record)]
end
FS -->|flush on Save or fsync| DD
DD -->|restore on next boot| FS
M[Mission checks] -->|completeMission| PG
R[Reset] -->|resetDataDisk wipes| DD
R -.->|progress survives| PG
Engineering Challenges
apk fetchlies when it finds nothing. Wrong package names (sqlite3instead ofsqlite, Debian’sxserver-xorg-coreinstead of Alpine’sxorg-server) exit 0 with zero files written. The install step then reported success against an empty directory. The fetch script now clears the output directory first, fails on an empty result, and prints what it wrote.- Setup ran as root, so
$HOMEwas/root. The first-boot script created fixtures in the wrong home directory and three missions validated files that did not exist. The fix splits the phase: packages install as root, the setup script runs as theuseraccount, and the marker file lands in the visitor’s home where they can see it. Xorg.wraprefuses to start outside a console. The graphical exhibit failed with “Only console users are allowed to run the server.” A probe script (scripts/probe-x11.mjs, kept in the repo) tested the standardXwrapper.configfix againstsudo -n: the config change did not pass the console check, so missions launch the server throughsudo, which is also the path unkernel’s own docs use. The probe dumps the framebuffer to a PNG, which is how X was proven working before any UI code existed.- GUI validation needed pixels, not strings.
readFrame()returns null until a client draws, and X repaints a few hundred milliseconds after a command returns. The pixel checks retry across fresh frames (30 × 400 ms), report the actual count on failure, and runpidof Xorgso the error says whether the server is even up.
How I Used AI
Built end-to-end with an AI coding agent: research pass over the unkernel repository, then implementation stage by stage. The honest headline is the same as any agent-built project: the value was in the verification loop. Every bug below was caught by running the code, not by reading it:
- Distro image requested at
/distros/alpine.erofswhile the file shipped at/distro/alpine.erofs— first real boot died with HTTP 404 await paramsoutside<Suspense>— Next 16 flagged the route as blocking instant navigation; fixed by streaming the param through a boundary- Reload before the ext4 journal committed ate a test file — Save became an explicit flush, the e2e clicks it before reloading, and
pagehidefires a best-effort sync - The mission engine’s stub runtime fell behind the interface twice (
exitCode: nullon signal death, then the seven new frame/input methods) — TypeScript caught both before CI did
I wrote the mission designs, the validation strategies, the historical copy and the release criteria. The agent wrote the code; the test suite and the probe scripts decided what was true.
Limitations (documented, not hidden)
- JSPI is required to boot: Chrome/Edge 137+, Firefox 153+, Safari 27+. Older browsers can browse the archive but cannot launch an environment.
- The workstation is desktop-first. Archive, timeline and exhibit pages work on small screens; the three-panel layout is not certified on mobile.
- The SDK’s worker mode is experimental. An inline fallback exists and logs when it triggers.
- No live memory snapshots. Reset is the recovery path, and persistence is flush-on-save, not flush-on-every-keystroke.
- The repository ships its runtime assets (distro image and package closures, ~110 MB of git) so builds stay deterministic and work offline.
Testing
22 Vitest unit tests cover the zod content schemas, every mission validation strategy against a stub runtime, and the runtime state machine with the SDK mocked: double-boot guard, first-boot setup ordering, output replay to late subscribers, reset clearing the right disk.
9 Playwright tests run the real kernel in Chromium: boot, uname -a output, create a file, Save, reload, the file survives, a mission completes against guest state, and Reset wipes it while progress stays. The other tests compile a COBOL program whose output (42042) appears nowhere in the typed source, import a CSV and finish a SQLite mission, and start X.Org until framebuffer pixels cross the mission’s threshold. CI runs typecheck, lint, unit, build and the full browser suite on every push.
Build
git clone https://github.com/favzqn/archive-zero
npm install # downloads and sha256-verifies the pinned distro image
npm run dev # http://localhost:3000
npm test # 22 unit tests
npm run test:e2e # 9 browser tests against the real kernel
Node 24+ locally; visitors need a JSPI-capable browser. All runtime assets are committed, so nothing fetches at build time.
Result
- All 31 tests green: 22 unit, 9 end-to-end against a real WebAssembly kernel
- Five exhibits, twenty-five missions, every check answered by the guest itself
- X11 in a browser tab: Xorg + xterm + twm at 800×600, input through evdev, packages installed offline
- Zero backend: static hosting only; disks, progress and previews never leave the machine
- Public repo with CI and a link audit that replaced eight dead reference URLs before launch
Shows: systems-level browser engineering (WebAssembly kernel, service-worker protocol bridge, framebuffer rendering), test automation that runs against nondeterministic runtime code instead of mocks, and historical writing detailed enough to ship the thing as a museum rather than a demo.
Building something similar?
I'm open to exciting products, collaborations, and engineering opportunities.