ADR-031: Core Layer for Domain Types
Status: Accepted Date: 2026-10-16
Context
Persisted domain types and the logger are needed by every layer, including the one that stores data, and have no React or I/O dependencies. Without a home below infrastructure, lower layers imported them from higher ones and broke the downward-only dependency rule.
Decision
- The frontend has five layers:
app>features>shared>infrastructure>core. Dependencies point downward only. coreholds the persisted domain types (core/types/) and dependency-free utilities (the logger). It imports nothing from other layers and has no React or I/O.sharedis limited to cross-feature React code: components, hooks, and utilities. Pure helpers that onlyfeaturesneed stay inshared/utilsand move tocoreonly when a lower layer needs them.- An architecture test in src/test/ checks every layer against every higher layer, and the coding harness runs it at the end of every turn that changes frontend code.
Consequences
- The dependency direction is enforced in full and easy to learn (Learnability, Evolvability).
- Persisted types sit in one place, so schema changes are easy to spot; the architecture guard watches
src/core/types/**. - Imports between feature modules are still allowed (Section 11).