Workspace & Dependency Tiers
Four-tier dependency model separating application surfaces, domain capabilities, shared foundations, and tooling presets across the frontend workspace.
Purpose & Scope
This reference defines the structural dependency model governing BookWorm’s three web surfaces—Storefront, Commerce, and Backoffice—and their shared platform libraries. It establishes strict one-way dependency tiers so domain UI, transport contracts, and configuration presets remain reusable without circular coupling.
Workspace Tier Hierarchy
The visual below illustrates how dependencies flow strictly downward from deployable web surfaces through domain capabilities and shared foundations to configuration presets.
Loading graph...
Architectural Principles & Rules
- Strict one-way dependency flow: Higher tiers may depend on lower tiers, never the reverse. Application surfaces consume domain and foundation layers; domain capabilities consume foundations; foundations remain independent of domain UI.
- Direct source composition: Shared layers resolve directly from source within the workspace rather than through intermediate package registries, keeping cross-surface changes atomic while automated boundary checks prevent illegal imports.
- Composable capability configuration: Environment validation, telemetry startup, and API contracts are split into focused capability modules so each surface only adopts what its runtime requires.
Shared domain and foundation modules must never import from an application surface. Any capability needed by more than one surface belongs in the domain or foundation tier before it is consumed.
Patterns & Boundaries
| Concern / Surface | Architectural Approach | Responsibility Boundary | Key Trade-off |
|---|---|---|---|
| Application Tier | Independent deployable web surfaces (Storefront, Commerce, Backoffice) | Owns route entrypoints, surface layouts, and feature composition | Separate deployments require explicit shared shell contracts for visual continuity |
| Domain Tier | Shared UI system, customer shell, transport clients, query factories, auth, SEO, and validation | Owns reusable business-aligned UI and typed service integration | Changes to shared customer shell trigger rebuilds across both customer surfaces |
| Foundation Tier | Pure domain types, environment schemas, telemetry initialization, and stateless utilities | Owns cross-cutting primitives with zero UI or framework coupling | Must remain free of React, routing, or domain-specific business logic |
| Config Tier | Standardized linting, type-checking, test harness, and build presets | Owns engineering standards and quality gate definitions | Centralizing presets enforces uniformity but requires coordinated upgrades |
- Storefront: Public customer discovery, catalog browsing, customer reviews, conversational AI assistant, and customer authentication ownership.
- Commerce: Authenticated customer transactions including shopping basket, checkout confirmation, customer profile, and order history.
- Backoffice: Staff administration dashboard covering inventory management, catalog taxonomy, buyer directory, order lifecycle actions, and review moderation.
Quality & Operational Impact
- Maintainability: Automated boundary enforcement prevents spaghetti dependencies and keeps domain logic portable across surfaces.
- Build & CI Efficiency: Scoped dependency graphs enable affected-only validation so isolated surface changes do not needlessly rebuild unrelated layers.
- Security & Reliability: Isolating environment schemas and authentication adapters in lower tiers ensures consistent validation and session handling across all surfaces.