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

Read the architecture guide →

Customer Surface Onboarding

Architectural decision flow for placing, registering, protecting, and verifying new customer-facing routes across Storefront and Commerce.

ArchitectureReference

Purpose & Scope

This reference defines the architectural onboarding workflow when introducing a new customer-facing capability or route across BookWorm’s two customer zones: Storefront and Commerce. It ensures new pages land in the right caching and authentication boundary, avoid API Gateway prefix collisions, and integrate cleanly with the shared customer shell.

Onboarding Decision Flow

  1. Select the Owning Customer Zone

    Assign the capability to Storefront if it is public, cacheable, and search-indexed (catalog, editorial content, reviews). Assign it to Commerce if it is authenticated, user-specific, and must never be cached (basket, checkout, account, orders).

  2. Verify Gateway Prefix Reservation

    Confirm the chosen URL segment does not collide with reserved backend capability prefixes (Catalog, Basket, Ordering, Rating, Chat, Identity) or the Backoffice administrative base path.

  3. Create Thin Route & Feature Slice

    Define a thin route entrypoint for metadata and server prefetching, and place all interactive UI, validation schemas, and query hooks inside a domain-aligned feature slice.

  4. Register Zone Routing & Protection

    If placed in Commerce, register the new top-level path pattern in the shared microfrontend routing manifest and add it to the edge session-protection list so unauthenticated visitors redirect to sign-in with a return URL. Storefront routes require no manifest entry because Storefront owns the catch-all fallback zone.

  5. Wire Cross-Zone Navigation & Verify

    Use the shared customer shell’s zone-aware link component when linking between Storefront and Commerce, then verify gateway routing via the zone response header and run all static, unit, and build quality gates.

Reserved Prefix Collision Rule

Never introduce new customer routes under reserved backend API prefixes. Existing exact-match exceptions (such as the shopping basket page sharing a top-level segment with basket API operations) are special-cased in gateway precedence and must not be replicated for new features.

Patterns & Boundaries

Concern / SurfaceArchitectural ApproachResponsibility BoundaryKey Trade-off
Zone PlacementPublic/cacheable -> Storefront; Private/dynamic -> CommerceProduct and frontend leads decide placement based on cacheability and auth requirementsMisplacing a private page in Storefront risks accidental caching or crawler exposure
Gateway ManifestSingle shared routing manifest consumed by both API Gateway and Next.js zonesCommerce top-level routes must be explicitly listed; Storefront catches all remainderRequires coordinated gateway + frontend update for new top-level Commerce prefixes
Session ProtectionEdge proxy guard on Commerce routes redirecting unauthenticated requests to Storefront loginCommerce enforces route-level cookie presence; backend APIs enforce token authorizationProtects private UI shells without duplicating login handlers
Cross-Zone LinksZone-aware navigation links in the shared customer shellShared shell owns navigation chrome and prefetch behaviorFull-document reload when crossing zones, traded for clean runtime isolation

Quality & Operational Impact

  • Zero Routing Surprises: Checking reserved prefixes and manifest registration upfront prevents 404 or backend JSON collision errors in production.
  • Security by Default: Enforcing edge session guards on Commerce routes ensures unauthenticated users are cleanly redirected before rendering private layouts.
  • Consistent UX: Using the shared customer shell keeps navigation, basket state, and accessibility landmarks uniform across every new customer page.