interface domain
owns user-visible structure, semantic visual tokens, component variants, and server-synchronized UI state.
why
what the user sees composes owned facts: server state, tokens, variants, labels. each has exactly one edit site โ the query that fetches, the mapper that owns meaning, the component that renders. blurred ownership means visual truth drifts between screens and no single fix restores it.
when to use
owns decisions about what the user sees and which owner produces it โ tokens, variants, labels, server-synchronized state, truthful loading and form states. backend transport behavior belongs to the contract domain.
good and bad
bad
component fetches, styles raw status, and decides its own retry behavior.
one file owns transport, state meaning, and presentation. a status meaning change ("pending" becomes "queued") forces edits in every component interpreting it. each component retries differently. a second component duplicates the fetch and retry logic. result: unmaintainable, coupled to API details.
good
query hook reads state; label mapper translates it; component renders it.
- query hook owns fetch and cache.
- label mapper owns status translation and display text โ a meaning change edits one file.
- component owns only rendering.
- shared logic is reusable; transport stays hidden.
every screen derives status text, tokens, and state from the same owners, so a meaning change ships everywhere at once and no screen disagrees with the durable facts.