Skip to content

A Design System That Checks Itself

The design system behind this site, published as a live page. Tokens read from the stylesheet, every component rendered from its real source, a working dashboard, and the checks that keep it honest.

Laptop showing the design system dashboard demo in dark mode with a sidebar, four stat cards with sparklines, an area chart, a donut chart and a bar chart
Client
This site
Year
2026
Scope
Design System · Front-End Architecture · Accessibility · Performance
Stack
Design System · Astro · Tailwind 4 · Accessibility · Performance · Security

The design system page is the design system itself, not a description of one. Nothing on it is a screenshot or a copy: components render from their real source files, and the tokens are parsed out of global.css at build time.

The problem

Most design-system documentation rots. Someone changes a token or adds a component, the docs page does not move, and within a quarter it describes a site that no longer exists. I wanted the opposite: a page that cannot disagree with the code, and checks that fail when it tries.

What I built

  • Foundations read from the theme. Color roles, light and dark values, contrast ratios, shadows and the radius scale come from parsing the stylesheet, so a token change shows up on the next build with no edit to the docs.
  • Every component, live. Primitives, composites and page patterns render from the same files the site uses, each with its source path, variants and a usage note. A registry plus a test fails the build if a component file exists that is not documented or explicitly omitted.
  • A real dashboard. A full-window admin demo with a collapsible sidebar, mobile sheet, stat cards and animated charts, built on shadcn patterns and mapped onto the site tokens instead of importing a second color system.
  • Accessible navigation. Tabs are anchors first, so the page works without JavaScript; with it, they become a proper tablist with arrow keys and deep links.

The guardrails

  • Token check. A build script fails if any theme color is missing its channel companion in light or dark, which is what makes opacity utilities work in both themes.
  • Types and tests. astro check and a unit-test suite cover the pure logic: filters, pagination, count-up math, image variants, nav menus, the headers generator, the tab and token helpers.
  • Security headers. A CSP is generated at build from the hashes of every inline script in the final HTML, so adding a script or a chart library cannot silently break production. The page prints the real policy from the same module that writes it.
  • Accessibility rules. Skip link, one focus ring, state never carried by color alone, a reduced-motion branch for every animation.

Performance

Images go through a pipeline that measures quality rather than assuming it: each WebP variant must clear a PSNR, mean-error and 99.9th-percentile-error bar against the source, or the encoder steps up, down to lossless. Load order is a set of recorded decisions: inlined CSS, a preloaded latin font, island runtime deferred past first paint, hydration chosen per island, and the heavy chart bundle isolated to the one page that needs it.

Next case study Charity Concert with Stripe
Read next

Building something AI-first? Let's talk.

GEO/AIO strategy, MCP and agentic architecture, marketing-engineering ops. Or just say hi.