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

Read the architecture guide →

ADR-002: Scope each basket to the authenticated customer

Each customer has an independently addressed pre-order basket, and the Cart System does not expose a shared cart or own the resulting Order.

October 21, 2026AcceptedOwnership

1. Context & Problem

A customer’s BasketEntityv1.0.0BasketCustomer-scoped, mutable pre-order collection of requested books and quantities managed prior to checkout.Ownercommerce-fulfillment-teamOpen docs represents their personal, pre-order purchase intent. If callers were allowed to specify any basket identifier they wanted, or if baskets were treated as a shared workspace, one user could read or alter another customer’s cart. It would also blur the boundary between active ShoppingDomainv1.0.0ShoppingCoordinates the customer basket and pre-purchase checkout intent, from selecting books through handing an accepted purch...Ownercommerce-fulfillment-teamDiagramOpen docs intent and confirmed OrderingDomainv1.0.0OrderingCreates durable Orders from a buyer's current basket, locks purchase-time pricing, and owns order lifecycle transitions ...Ownercommerce-fulfillment-teamDiagramOpen docs records.

2. Business Value

  • Strong customer privacy and security: Prevents unauthorized access or accidental cross-customer cart tampering.
  • Clear ownership boundaries: Reinforces that a basket belongs solely to one authenticated shopper before checkout, while confirmed orders belong to OrderingDomainv1.0.0OrderingCreates durable Orders from a buyer's current basket, locks purchase-time pricing, and owns order lifecycle transitions ...Ownercommerce-fulfillment-teamDiagramOpen docs.
  • Consistent access control: Applies one predictable ownership rule across both storefront requests and internal service-to-service workflows.

3. How It Works

Each authenticated customer is automatically matched to their own personal BasketEntityv1.0.0BasketCustomer-scoped, mutable pre-order collection of requested books and quantities managed prior to checkout.Ownercommerce-fulfillment-teamOpen docs containing their selected Basket ItemEntityv1.0.0Basket ItemChild entry within a Basket pairing a Catalog book identifier with a positive requested quantity.Ownercommerce-fulfillment-teamOpen docs references and quantities. Callers never choose a basket identifier on their own—the system derives the basket’s location strictly from the verified customer identity on the request.

This rule applies uniformly to every operation—reading, creating, updating, and deleting—whether the request comes directly from a customer’s browser or from an internal service acting on the customer’s behalf. Any attempt to access another customer’s basket is rejected explicitly rather than returning an empty cart. After checkout completes, ownership of the resulting purchase transfers to OrderingDomainv1.0.0OrderingCreates durable Orders from a buyer's current basket, locks purchase-time pricing, and owns order lifecycle transitions ...Ownercommerce-fulfillment-teamDiagramOpen docs.

4. Trade-offs & Lessons Learned

  • No shared baskets: This design intentionally rules out shared family carts, collaborative shopping lists, or using baskets as historical order records.
  • End-to-end identity propagation: Internal services cannot treat internal access as a free pass to look up arbitrary customers’ baskets; they must always pass along the intended customer’s verified identity context.
  • Fail-closed enforcement: Cross-customer access attempts must fail explicitly rather than masking unauthorized requests with an empty basket response.
  • Rate limiting is not authorization: Per-user traffic limits help protect public entry points from abuse, but they do not replace strict customer-level authorization and identity checks.

5. Technical Reference

  • Identity-derived key: Basket APIServicev1.0.0Basket APIInternal HTTP and gRPC service for managing customer-scoped shopping baskets, Catalog price enrichment, and post-checkou...PublishesGetBookGrpc, GetBooksGrpc +2SubscribesCreateBasket, UpdateBasket +4APIsOpenAPI, AsyncAPIOwnercommerce-fulfillment-teamDiagramRepositoryOpen docs derives the customer-scoped Redis key directly from the authenticated customer identity; callers never supply a basket ID.
  • HTTP surface: Requires customer authorization and enforces per-user rate limiting across read, create, update, and delete endpoints.
  • Internal gRPC surface: The internal gRPC query returns the current customer’s BasketEntityv1.0.0BasketCustomer-scoped, mutable pre-order collection of requested books and quantities managed prior to checkout.Ownercommerce-fulfillment-teamOpen docs without accepting a basket ID parameter; service-to-service callers must preserve the authenticated customer identity context.
  • Data scope: BasketEntityv1.0.0BasketCustomer-scoped, mutable pre-order collection of requested books and quantities managed prior to checkout.Ownercommerce-fulfillment-teamOpen docs and Basket ItemEntityv1.0.0Basket ItemChild entry within a Basket pairing a Catalog book identifier with a positive requested quantity.Ownercommerce-fulfillment-teamOpen docs represent pre-order state only; OrderingDomainv1.0.0OrderingCreates durable Orders from a buyer's current basket, locks purchase-time pricing, and owns order lifecycle transitions ...Ownercommerce-fulfillment-teamDiagramOpen docs owns the accepted Order lifecycle post-checkout.