Storefront has been decoupled into micro-frontends with a dedicated commerce app and shared shell.

Read the architecture guide →

Workspace & Dependency Tiers

Four-tier dependency model separating application surfaces, domain capabilities, shared foundations, and tooling presets across the frontend workspace.

ArchitectureReference

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.
Non-Negotiable Dependency Boundary

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 / SurfaceArchitectural ApproachResponsibility BoundaryKey Trade-off
Application TierIndependent deployable web surfaces (Storefront, Commerce, Backoffice)Owns route entrypoints, surface layouts, and feature compositionSeparate deployments require explicit shared shell contracts for visual continuity
Domain TierShared UI system, customer shell, transport clients, query factories, auth, SEO, and validationOwns reusable business-aligned UI and typed service integrationChanges to shared customer shell trigger rebuilds across both customer surfaces
Foundation TierPure domain types, environment schemas, telemetry initialization, and stateless utilitiesOwns cross-cutting primitives with zero UI or framework couplingMust remain free of React, routing, or domain-specific business logic
Config TierStandardized linting, type-checking, test harness, and build presetsOwns engineering standards and quality gate definitionsCentralizing presets enforces uniformity but requires coordinated upgrades

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.