← Projects
ARCHIVE.ZERO

ARCHIVE.ZERO

2026 · Personal project · portfolio

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

Next.jsTypeScriptUnkernelWebAssemblyxterm.jsX.OrgSQLiteGnuCOBOLPlaywright
5 executable exhibits
25 guided missions
31 automated tests
0 simulated terminal output

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:

  1. 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.

  2. The Mainframe Ledger (intermediate, ~50 min). GnuCOBOL compiled by missions, not shown in screenshots: a first cobc -x program, fixed-width customer records read through an FD, a ledger that rejects bad rows with CHECK-style validation (INVALID 2 on a feed with two poisoned entries), a 500-row batch whose summary line must read SUMMARY 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.

  3. The Birth of the Web (beginner, ~40 min). Hand-write HTML, start python3 -m http.server, probe it with curl -sI until HTTP/1.0 200 lands in a file, then preview the live site in an iframe that reaches the guest’s loopback over vsock. Later missions capture a 404, compare GET with POST, and ship a two-page site with working relative links.

  4. The Relational Model (intermediate, ~40 min). SQLite from zero: import a CSV, declare PRIMARY KEY / NOT NULL / CHECK and watch the engine reject a negative balance, join customers to orders so ZENITH TEXTILES|120000 ranks first, aggregate twelve rows into five totals with GROUP BY, and export a TOTAL|295000 report the validator reads back from disk.

  5. The Graphical Desktop (intermediate, ~45 min). Start sudo -n X :0 on 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; add twm for 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.

The archive explorer: five exhibit cards with category, difficulty and environment metadata
The archive explorer: five exhibit cards with category, difficulty and environment metadata

How the missions are checked

Representative validators, all executing against the guest rather than a UI flag:

ExhibitMissionWhat the validator runs
UnixThe Unix Philosophysort -u top-errors.txt | wc -l prints 5, plus five fixed-string content checks
UnixProcesseskill -0 on the recorded PID must fail, and the PID file must be numeric
MainframeOvernight Batchcobc -x && ./batch output equals SUMMARY OK=480 FAIL=20 CREDIT=8136000 DEBIT=8160000
MainframeFind the Corruptionthe report file contains exactly the tokens L07 L19 L33 L44 L61
WebYour First Web Servercustom check: vm.fetch("http://localhost:8000/") returns 200 with an <h1> in the body
RelationalThe Jointhe .sql file contains JOIN, and executing it prints ZENITH TEXTILES|120000 first
GraphicalStart the Display Serverframebuffer read: ≥ 20,000 lit pixels across retried frames
GraphicalPaint 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:

  1. checkSupport() — JSPI, WebAssembly, BigInt; failure renders the SDK’s own diagnostics
  2. Fetch the exhibit’s setup script and .apk files, then stage them as a plain object tree
  3. createKernel({ worker: true, display, disks: [{ kind: "data", template: "bundled", name }] })
  4. First boot only: install packages (root), run the setup script (user, so $HOME is right), drop a marker file
  5. Console output since boot replays into xterm.js; status flips to ready
  6. 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. UnkernelRuntime is the only file that imports unkernel/web. Components speak a small ExhibitRuntime interface, so a future engine swap touches one module.
  • Offline by construction. A Node script fetches Alpine .apk packages once; first boot installs them from a 9p mount with apk add --no-network, or straight tar extraction 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 with vm.fetch() over vsock. The guest’s http.server reaches 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

  1. apk fetch lies when it finds nothing. Wrong package names (sqlite3 instead of sqlite, Debian’s xserver-xorg-core instead of Alpine’s xorg-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.
  2. Setup ran as root, so $HOME was /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 the user account, and the marker file lands in the visitor’s home where they can see it.
  3. Xorg.wrap refuses 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 standard Xwrapper.config fix against sudo -n: the config change did not pass the console check, so missions launch the server through sudo, 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.
  4. 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 run pidof Xorg so 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:

  1. Distro image requested at /distros/alpine.erofs while the file shipped at /distro/alpine.erofs — first real boot died with HTTP 404
  2. await params outside <Suspense> — Next 16 flagged the route as blocking instant navigation; fixed by streaming the param through a boundary
  3. Reload before the ext4 journal committed ate a test file — Save became an explicit flush, the e2e clicks it before reloading, and pagehide fires a best-effort sync
  4. The mission engine’s stub runtime fell behind the interface twice (exitCode: null on 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.