[view source]

why wasm — Jonathan Garay

Last login: Tue Aug 18 09:16:04 2026 on ttys001
guest@garay.mx:~$ cat posts/2026-08-18-why-wasm.md
# why wasm

This site began as one HTML file with a vanilla JS shell — and
it worked fine. But it offended the resident engineer. So now
the terminal you are typing into is a Zig program compiled to
wasm32-freestanding. JavaScript has been demoted to a display
driver: it moves keystrokes in and markup out.

## the architecture

The build tool (garay.zig, plain zig run, no build system)
compiles posts from markdown to HTML exactly once, packs every
blob of content into fs.pak — which the shell loads at boot —
and emits a static page per post so crawlers never have to run
a single line of script.

Commands live in a registry: a name, a summary, one function.
Adding a command to the shell is a ten-line diff. ls, cat, cd,
the jokes — same table, same contract.

The engine talks to the page in terminal escape codes: clear
is ESC[2J, the document title is OSC 0, the working directory
is OSC 7 — and the browser URL bar is just another status
line the shell writes to.

## but why

Because a blog does not need a wasm binary, and that is the
point. Nobody needed a text file drawn in box characters
either; the scene made them anyway, and made them beautiful.
Unnecessary rigor is the whole aesthetic.

EOF
guest@garay.mx:~$