Skip to main content

Rings: how I'm layering this site so pages stop colliding

December 2, 2026
Two new pages both touched the nav and collided. That was the push I needed to give this site the same architecture rules as my other projects.

The rule

My standard for a codebase is rings. From the inside out: Entities, Domain, Infrastructure, Shared UI, Features, Composition. A module can only depend on rings further in than itself, and an automated test enforces that. This site didn't have that test. I knew, and I'd written it down as a gap. My architecture notes were already written up, but notes don't fail a build.

What set it off

New pages kept colliding in shared files. The last straw was the FlowKit page and the GlassLikeUI page: both changed the nav header and conflicted. When I looked properly, the nav header file had grown huge and kept colliding. The project list was hard coded twice, once for desktop and once for mobile. And three separate changes of mine had each added a focus ring for the same parts of the nav. So the goal is simple: adding a page shouldn't break the other pages I've got in progress.

The rings in this site

Here's how the six rings map onto the site:
Entities
types, generated data, content data, assets
Domain
pure logic and helpers
Infrastructure
server code and stores
Shared UI
shared components
Features
feature folders (new)
Composition
routes and the app's entry files

What the test checks

The test reads every source file in the site, works out what each import really points at, and fails on any of these:
  • an import that points outward
  • a file that isn't in any ring
  • an import that lands somewhere no ring covers
And an empty scan can't pass, so a broken file search doesn't quietly turn into a green test. My favourite part: a new top-level folder fails the test until I place it in a ring on purpose. Where new code lives becomes a decision, not an accident. A review pass turned up one gap early: some imports were checked as written, not by the file they really point at. Now each import is resolved to the real file first, then checked.

Status: merged.

The seven steps

The test was step one of seven. All seven, in order:
  1. The architecture test. (Done.)
  2. A page list: one entry file per page, gathered automatically, with the prerender test driven by it. (Done.)
  3. The nav built from that list: desktop and mobile from one loop, one focus rule per selector, and the nav checks moved out of each page's tests. (Done.)
  4. The interest form's project list built from the page list too. (Done.)
  5. The image script scans folders and writes one manifest per folder. (Done.)
  6. Test and build settings that pick up new pages on their own, and page-only code moved into feature folders. (Done.)
  7. Tighter rules: no feature importing another feature, no route importing another page's code, and no hard coded project paths in the nav. (Done.)
A few calls I made up front: the projects menu is sorted by name, each page gets one entry file, image manifests are committed, one per image folder, and the sitemap and shared page meta waited until the seven steps were done. If any of this shifts coverage or mutation scores, the shift gets a one-off reset that's written down. The bar never goes lower. With steps 2 and 3 in, a new project page adds an entry file, a route folder, a feature folder and its own tests, and touches nothing shared. The blog isn't a project page, so it still needed a nav tab and a few shared test and config entries.

Deleting instead of fixing

The Dependi page needed a real screenshot of the Acknowledgements screen, and it wasn't ready. To let the end-to-end tests run before it existed, I added a test-only route and a preview build. A review pass flagged that setup as risky to keep around. I could have hardened it. Instead, once the real screenshots were in, I deleted the whole thing: subtract before you add. What went: the test-only route and the bits of test setup that only existed for it. The screenshots came from a throwaway app showing the real Acknowledgements screen, in dark and light.

Status: merged.

Getting that page through also swapped timing-based waits in the tests for a page-ready signal, so the tests wait for the page to say it's ready instead of guessing how long it takes.

The smaller bits already in place

  • GlassLikeUI, my component library, only holds components that mirror native iOS glass. Anything that combines them lives in the site, not the library.
  • The tools my builds pull in are locked to exact versions by the lockfile, for supply-chain safety.
  • Every change runs the same gate before it merges: type check, lint, unit coverage, mutation testing, end-to-end tests and a production build.

Notes and good intentions didn't keep this site's shape. A test that fails on a wrong-way import will. The test was the first step. The other six are in now too.