---
title: Applications & Zone Routing
summary: Surface boundaries across Storefront, Commerce, and Backoffice, reverse-proxy gateway precedence, and search indexing scope.
owners:
  - catalog-experience-team
badges:
  - content: Architecture
    backgroundColor: purple
    textColor: purple
  - content: Reference
    backgroundColor: blue
    textColor: blue
---

## Purpose & Scope

This reference defines the application boundaries and ingress routing rules across BookWorm's three web surfaces: **Storefront**, **Commerce**, and **Backoffice**. It governs how external requests enter through a single **API Gateway** origin, how zone precedence resolves overlapping paths, and which surfaces are exposed to public search indexing.

## Surface & Gateway Routing Topology

The visual below shows how customer and staff requests enter the single-origin **API Gateway** and route deterministically to backend capability APIs, the external identity provider, or the owning frontend surface.

<MermaidFileLoader file="mermaids/006-microfrontend-architecture-diagram-1.mmd" />

## Architectural Principles & Rules

- **Single public origin:** All browser traffic enters through the **API Gateway** reverse proxy. Frontend surfaces and backend APIs run on internal ingress only and are never exposed directly to end users.
- **Deterministic precedence:** Backend API prefixes and identity provider routes match ahead of general frontend routes. **Storefront** acts as the lowest-priority catch-all surface for public customer discovery.
- **Exact-match collision resolution:** Where a customer page shares a top-level path segment with a backend API domain (such as the shopping basket page versus basket data operations), exact page routes take higher precedence than wildcard API prefixes.
- **Isolated static assets:** Each customer zone serves its static scripts, styles, and media under a distinct asset prefix so deployments never collide on shared paths.
- **Zone observability:** The gateway stamps every frontend response with a zone identifier header to support rapid routing diagnostics.

<Admonition type="info" title="Search Indexing Boundary">
	**Storefront** is the only surface configured for public search indexing and structured metadata.
	**Commerce** and **Backoffice** serve private, user-specific or staff-only workflows and must
	remain excluded from search engine crawlers.
</Admonition>

## Patterns & Boundaries

| Concern / Surface | Architectural Approach                                                                 | Responsibility Boundary                                                                          | Key Trade-off                                                                               |
| :---------------- | :------------------------------------------------------------------------------------- | :----------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------ |
| **Storefront**    | Public catch-all zone with aggressive component caching and structured SEO metadata    | Owns landing showcase, catalog discovery, book details, reviews, customer auth, and AI assistant | Catch-all ownership means new top-level routes in other zones must be explicitly registered |
| **Commerce**      | Explicit transactional zone with dynamic, uncached rendering and crawler exclusion     | Owns shopping basket, checkout confirmation, customer account, and order history                 | Depends on **Storefront** for initial sign-in handoff while sharing the origin session      |
| **Backoffice**    | Isolated staff zone mounted under a dedicated administrative base path                 | Owns KPI dashboard, catalog CRUD, customer management, order operations, and review moderation   | Requires explicit staff role enforcement and separate authentication scopes                 |
| **API Gateway**   | Reverse proxy reading a shared customer routing manifest alongside backend route rules | Owns TLS termination, CORS enforcement, prefix stripping, and zone header tagging                | Adding a top-level **Commerce** route requires updating the shared routing manifest         |

<Accordion title="Domain Backing Alignment">

- **Catalog & Discovery:** Backed by **Catalog API** and **Rating API** for book details, taxonomy directories, and customer feedback.
- **Shopping & Ordering:** Backed by **Basket API** and **Ordering API** for cart persistence, checkout, and order lifecycle tracking.
- **Conversational Discovery:** Backed by **Chat API** through a dedicated server-side assistant runtime in **Storefront**.

</Accordion>

## Quality & Operational Impact

- **User Experience:** Serving **Storefront** and **Commerce** behind one origin eliminates cross-domain redirects, cookie-scoping friction, and CORS complexity for shoppers.
- **Performance:** Isolating **Storefront** from transactional **Commerce** workflows allows public catalog pages to be aggressively cached without risking stale basket or order data.
- **Security:** Internal-only container ingress ensures all traffic passes through gateway routing, CORS, and identity boundaries.
