Orchestrating Scalable Frontends: The Power of the Composition Root
Frontend applications built with isolated feature modules face a coordination problem: how do features communicate without coupling to each other? The solution is treating the Pages layer as a Composition Root — a concept from Clean Architecture — where features are instantiated and their interactions orchestrated. Features remain 'dumb' about global context, while pages act as directors connecting feature contracts via callbacks and events. This prevents 'God Features' (feature cannibalization) and enables substitutability: replacing an entire domain only requires changes in the pages layer. The hierarchy flows from app/ (global bootstrapping) → pages/ (orchestration) → features/ (domain logic) → shared/ (utilities), with communication always flowing vertically through the page, never directly between features.