Rings: how I'm layering this site so pages stop colliding
December 2, 2026Two 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
Status: merged.
The seven steps
The test was step one of seven. All seven, in order:- The architecture test. (Done.)
- A page list: one entry file per page, gathered automatically, with the prerender test driven by it. (Done.)
- 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.)
- The interest form's project list built from the page list too. (Done.)
- The image script scans folders and writes one manifest per folder. (Done.)
- Test and build settings that pick up new pages on their own, and page-only code moved into feature folders. (Done.)
- Tighter rules: no feature importing another feature, no route importing another page's code, and no hard coded project paths in the nav. (Done.)
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.