Case study · Nivoda

The rebuild was decided before a line of it was written

A code-first design system that cannot produce the wrong UI, built for a global jewellery marketplace, running in production.

Home page of the Clarity design system, headline reads ‘Clarity is an AI-native design system’
clarityai.design The system is live. Worth looking through before you decide anything. Open the live system →
Context
Nivoda, a global B2B jewellery marketplace
Duration
~3 months, foundations to ~63 components
Role
Team lead with one senior designer. Strategy, token architecture, component API design, build tooling, governance and docs
Stack
W3C DTCG tokens (OKLCH) · shadcn/ui + Radix · Tailwind v4 · Nx monorepo · Fumadocs · Storybook
Shipped
Token pipeline · component library · live validation app · agent-readable docs · governance model · 4 ADRs
The bet behind it: encode the judgment, not just the components, so the quality bar travels with the system rather than with whichever designer happened to be in the room.

What the audit found

A system that suggested, but did not enforce

Nivoda had a working design system. Material UI, a hand-rolled token pipeline, more than sixty components. Fine on paper. The audit counted what was actually in the repository, and the shape of the problem was in the counts:

81per-component override files fighting Material's defaults
723sx={} escapes, each a place a token could be ignored
32component-specific token files to govern by hand

Each of those is a seam where design intent leaked. The team was paying, continuously, to make Material not look like Material, and responsiveness was bolted on per component rather than written into the contract.

The counting was not a formality before the interesting work. It decided the work. Two things came out of it that shaped everything after.

It said what to delete

The fastest way to waste a rebuild is to recreate the old system in nicer syntax. The audit produced a token-by-token comparison against what was actually shipping in production, not against what the design file claimed, and that comparison is what made the scope defensible.

It made the migration invisible

15 token-alignment decisions matched the new values to what production already rendered. That meant zero visual drift on adoption. No flag day, no re-skin for leadership to argue about, and no reason for anyone to block it.

What I believe: evidence first. A one-page diagnostic with real counts wins the room, and it tells you what to delete.

The mechanism

Correctly implemented was never the same thing as design-correct

Design specs Eng builds Design QA Catch drift Revise
The loop exists because "correctly implemented" was never the same thing as "design-correct."

That loop is not a process failure, and no amount of process improvement removes it. It exists because the thing being checked was never encoded anywhere a build could enforce. So a person has to verify the output by eye, and that verification is the loop.

The rebuild encoded it instead. Tokens, spacing, type, accessibility, responsiveness and the legal range of variants live inside the component API. The guard-rails are in the prop signatures, not in a Figma file or a reviewer's eye.

The consequence is the whole point. Nothing can build "correctly" and "design-incorrect" at the same time, so design has nothing left to catch.

Build with components Ship no QA gate
Same work, with the review loop removed, because correctness is structural rather than reviewed.

The drift checking did not get faster. It stopped being necessary.

Industry context: 66% of teams lose 25 to 50% of their time to design-delivery friction, about $298k a year per product pod. (Builder.io, not a client-measured result.)

The second problem

A component library says what. It cannot say why

A library tells you what the button looks like. It cannot tell you why it is that way, when to break the rule, or what good looks like for a flow nobody designed by hand. That judgment used to live in designers' heads, which is a single point of failure with a notice period.

Getting it out of their heads only matters if the system can be read, and the readers changed. Engineers, designers and product managers all build through agents now, and an agent never opens the design file. It reads the repository. So the documentation is not a website about the system, it is the interface to it:

  • A library map, a for and not-for index of every component, encoding when to reach for each one. The first thing an agent reads.
  • 63 colocated docs, props, usage, do and don't, sitting next to the code so they cannot drift from it.
  • TypeScript contracts as the spec, Storybook as executable examples, the Nx graph as machine-readable structure.

There is no sync step and no stale mirror, so an agent always reads current truth, and inherits the same judgment a senior designer would have applied by hand.

The brand system. Same tokens, for the surfaces code cannot reach. Colour, type, voice and application rules, written for agents. Open the brand system →

Outcomes

A week became half a day

A new screen, about a weekabout half a day

UI that came out design-correct, roughly 75%roughly 97%

Two things follow from those, and they matter more than the figures.

Product managers shipped UI. Not a mockup handed to an engineer. Finished interface, built against the system, with no designer in the loop and nothing for one to correct afterwards.

The senior designer stopped reviewing implementations and moved onto components, documentation and governance. The capacity did not get freed up in the abstract, it went somewhere.

The system was promoted internally by the people using it, and the CFO was among the ones pushing it hardest. (Observed across one team over three months, which is the honest scope of it.)

The bridge

The counting comes first, every time

Nivoda's numbers were 81, 723 and 32. Another codebase will have different ones, and the point is not the specific figures. It is that they were countable at all, and that counting them first is what made a three-month rebuild a decision rather than a bet.

That first step is the audit, and it is the same instrument every time: what is actually in the repository, what an agent can and cannot read in it, and what would have to change before it could build against it reliably. Some systems come out of it needing a rebuild. Plenty do not, and finding that out in a fortnight is the question worth asking before anyone commits to a rebuild.

The build

Three months, foundations to library

Tokens as the contract

W3C DTCG JSON in Git, vendor-neutral and spec-backed. Two tiers, primitives (color.azure.500) and semantic roles (action.primary). OKLCH colour for perceptually even ramps and predictable dark mode. One source compiles to web CSS, the shadcn theme, JS and TS, email and backend JSON, with semantic tokens emitting var(--…) chains so a primitive can be retargeted without recompiling anything downstream.

DTCG tokens · OKLCH primitive + semantic · in Git build.mjs ~230 lines · 20 tests Web CSS :root / .dark shadcn theme Tailwind JS / TS React Native Email inline values JSON backend
One token source compiles to every platform. Style Dictionary was replaced with a ~230-line bespoke build once the vendor cost more than it saved (ADR-001).
What I believe: semantic tokens with the intent in the name (color-feedback-error, never blue-5) are the highest-leverage move on the board, for human clarity and for agent output alike.

Components on headless primitives

Radix, Tailwind and code ownership through shadcn, the foundation OpenAI, Vercel, Linear and Supabase run on. No vendor design language to override back out. ~63 components across four tiers: 38 atoms, 16 molecules, organisms (FilterToolbar, Megamenu, Sidebar) and templates. One reference component, Button, was hardened first to define what finished meant for everything after it. All of it validated against a live app on real data, because done means it survives a real product surface rather than rendering in isolation.

Four decisions recorded as ADRs

A design system is mostly "do we adopt this tool?" calls, and the reasoning is the artifact:

  • Bespoke token build over Style Dictionary. Use the vendor until it costs more than it saves, then own a small tested script. Reversible, because the DTCG source never changed.
  • Removed visual-regression testing. Right tool, wrong time. One component, no CI, pure overhead, and a secret-exposure risk. Revisit at ten components.
  • Rejected Figma to code token sync. It solves a problem this team did not have. Designers explore in Figma, they do not author tokens there.
  • Markdown docs over a hosted hub. When the source is already agent-readable, read it directly rather than maintaining a polished copy of it.
The throughline: adopt the minimum tooling the stage justifies, document why, keep it reversible. That is most of what stops a young system collapsing under its own process.

Designed for the handover

Two token tiers, a readable ~230-line build, ADRs and in-repo docs. A system the team owns after I step out, not a black box with my name on it.

Start with the audit.