3 min read

How This Site Works: Vanilla JS, WebAssembly, and a Cloudflare Worker

  • JavaScript
  • WebAssembly
  • Cloudflare Workers
  • CSS
  • Architecture

Updated November 2026, after a redesign that changed most of what this post first described.

This portfolio looks like a typical modern web app, but there is no framework underneath: no React, no Vue, and no build step. The production site is plain ES modules served straight from GitHub Pages. This post walks through the architecture and the reasoning behind it.

Pre-rendered first, JavaScript second

The content lives in JSON files: projects, posts and work history. A generator script turns them into real HTML, so every project has its own page at /projects/<name>/, every post has one at /posts/<slug>/, and the project cards, experience and writing on the home page are already in index.html. The site reads fine with JavaScript turned off. A daily GitHub Actions workflow pulls fresh repository data from the GitHub API, regenerates the pages and redeploys, and CI fails if anyone hand-edits generated output.

A short critical path

main.js does only what the first paint needs: the service worker, the theme, navigation and the page shell. Then it signals that the app is ready and starts everything else independently, with sections near the viewport loaded first and the rest when the browser is idle. Nothing optional waits for anything else. By that ready point the home page has made about 14 requests and loaded about 184 KB, and a Playwright test fails the build if the script budget grows.

A WebAssembly particle field in the hero

The animated background behind the hero is a particle flow-field simulation written in AssemblyScript and compiled to WebAssembly. A capability check decides at runtime what you get: capable devices run the WASM simulation, others get a WebGL gradient, and everything else a static CSS gradient. With prefers-reduced-motion on, the animation never starts.

A small design system

Styling is split by page type: core.css is shared by every page, with the home page and article pages each adding one stylesheet of their own. Cascade layers keep the order explicit, and every colour, size and space comes from a token. Each colour token is defined once with light-dark(), so the theme follows your system and the toggle simply flips color-scheme. Stylelint rejects raw spacing and type values. Moving between a project card and its page uses cross-document view transitions, and the command palette (⌘K) and keyboard help are native <dialog> elements.

A Cloudflare Worker for the live parts

GitHub Pages is static, so anything dynamic lives in a Cloudflare Worker answering on the same domain under /api/. It keeps view counts in KV, runs the Turnstile-protected guestbook, caches my recent GitHub activity for the “currently coding” line, counts who is here right now with a Durable Object, and checks the home page every five minutes. Those checks, plus latency and error rates, feed the public status page. Cloudflare also caches the HTML at the edge for an hour and purges it on every deploy.

Readable by agents too

The site publishes an llms.txt, returns any page as Markdown when asked with Accept: text/markdown, and the Worker hosts a read-only MCP server at /mcp so an AI agent can read the projects, posts and work history, and the site’s own stats. In browsers that support WebMCP, the page itself offers a few tools, like searching projects or drafting a contact message (which it never sends).

Kept honest by CI

Every change runs ESLint, Stylelint, Prettier, Vitest unit and Worker tests, a check that every file the site references is actually published, and Playwright end-to-end tests with axe-core accessibility scans. Lighthouse CI audits desktop and mobile on every deploy and fails below 0.9 for performance or 0.95 for accessibility. The site is also an installable PWA with an offline page.

Could a framework do all this? Absolutely. But for a site this size, the browser platform alone turned out to be plenty, and every byte shipped is a byte I can explain.