---
title: Customer Surface Onboarding
summary: Architectural decision flow for placing, registering, protecting, and verifying new customer-facing routes across Storefront and Commerce.
owners:
  - catalog-experience-team
badges:
  - content: Architecture
    backgroundColor: purple
    textColor: purple
  - content: Reference
    backgroundColor: blue
    textColor: blue
---

## 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

<Steps>
<Step title="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).

</Step>
<Step title="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.

</Step>
<Step title="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.

</Step>
<Step title="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.

</Step>
<Step title="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.

</Step>
</Steps>

<Admonition type="warning" title="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.
</Admonition>

## Patterns & Boundaries

| Concern / Surface      | Architectural Approach                                                                               | Responsibility Boundary                                                                       | Key Trade-off                                                                            |
| :--------------------- | :--------------------------------------------------------------------------------------------------- | :-------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------------- |
| **Zone Placement**     | Public/cacheable -> **Storefront**; Private/dynamic -> **Commerce**                                  | Product and frontend leads decide placement based on cacheability and auth requirements       | Misplacing a private page in **Storefront** risks accidental caching or crawler exposure |
| **Gateway Manifest**   | Single shared routing manifest consumed by both **API Gateway** and Next.js zones                    | **Commerce** top-level routes must be explicitly listed; **Storefront** catches all remainder | Requires coordinated gateway + frontend update for new top-level **Commerce** prefixes   |
| **Session Protection** | Edge proxy guard on **Commerce** routes redirecting unauthenticated requests to **Storefront** login | **Commerce** enforces route-level cookie presence; backend APIs enforce token authorization   | Protects private UI shells without duplicating login handlers                            |
| **Cross-Zone Links**   | Zone-aware navigation links in the shared customer shell                                             | Shared shell owns navigation chrome and prefetch behavior                                     | Full-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.
