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

Read the architecture guide →

Data Flow & Gateway Integration

Typed transport contracts, retry and idempotency rules, optimistic concurrency with ETags, and real-time streaming channels.

ArchitectureReference

Purpose & Scope

This reference governs how Storefront, Commerce, and Backoffice communicate with backend capability services (Catalog API, Basket API, Ordering API, Rating API, and Chat API) through the API Gateway. It defines transport standardization, resilience policies, optimistic concurrency controls, and real-time streaming patterns.

Layered Data Flow

The visual below traces how feature slices interact with server query caches, minimal client state, resilient HTTP transport, and real-time streaming channels across the gateway boundary.

Loading graph...

Architectural Principles & Rules

  • Gateway-only communication: Frontend surfaces never call internal backend services directly; every request routes through the API Gateway using shared, typed domain contracts.
  • Safe retry & idempotency discipline: Transient timeouts, rate-limit responses (honoring server retry-after hints), and safe read methods retry automatically with bounded backoff. Non-idempotent writes only retry when carrying an explicit request idempotency identifier.
  • Optimistic concurrency for staff edits: Mutable administrative resources in Backoffice (such as catalog items and order summaries) exchange entity tags (ETag) on reads and require matching preconditions on updates to prevent silent lost updates.
  • Zero-retry on authorization & conflict failures: Missing credentials or stale precondition conflicts never retry automatically; the UI surfaces explicit re-authentication or reload-and-merge prompts.
No Ad-Hoc Network Calls in UI Components

Feature components must consume centralized query and mutation abstractions rather than issuing raw network requests. This guarantees uniform authorization token injection, correlation headers, retry rules, and cache key consistency.

Patterns & Boundaries

Concern / SurfaceArchitectural ApproachResponsibility BoundaryKey Trade-off
Standard REST & Query ReadsCentralized typed HTTP client with normalized cache keys and bounded retriesShared transport layer handles headers, retries, and error classification; feature slices handle presentationSlight abstraction overhead compared to inline fetches, repaid in consistent error and retry behavior
Optimistic ConcurrencyConditional reads and precondition-guarded writes via ETag headersBackoffice surfaces detect precondition conflicts and prompt staff to refresh before overwritingRequires staff to resolve concurrent edits manually rather than silent last-write-wins
Dashboard Metrics StreamInitial snapshot load followed by authenticated Server-Sent Events (SSE) with exponential backoffBackoffice dashboard subscribes to live ordering metrics; Ordering API pushes incremental updatesMaintains persistent connection per active admin session; falls back cleanly via bounded reconnects
Conversational AI StreamServer-side assistant runtime forwarding customer identity to Chat API over AG-UIStorefront mediates streaming responses and declarative UI cards; Chat API owns agent orchestrationAdds a lightweight server-side proxy hop in Storefront to keep agent integration decoupled from browser clients

Quality & Operational Impact

  • Reliability: Bounded retries with idempotency safeguards absorb transient network blips without creating duplicate orders or basket mutations.
  • Data Integrity: ETag precondition checks protect Backoffice operators from accidentally overwriting concurrent catalog or order updates.
  • Responsiveness: Real-time SSE and AG-UI streaming deliver live operational metrics and conversational AI responses without polling overhead.