ADR-001: Use Redis as the authoritative basket store
Redis is the authoritative store for active customer baskets, while accepted orders and Catalog data remain owned by their respective systems.
1. Context & Problem
During online shopping, customers frequently add, adjust, and remove items before deciding to buy. The Cart SystemSystemv1.0.0Cart SystemInternal system that owns customer-scoped baskets throughout the pre-order journey, including basket management, Catalog...Ownercommerce-fulfillment-teamDiagramOpen docs must support fast, responsive reads and writes for this changeable pre-order BasketEntityv1.0.0BasketCustomer-scoped, mutable pre-order collection of requested books and quantities managed prior to checkout.Ownercommerce-fulfillment-teamOpen docs without slowing down the storefront or tying temporary shopping activity to permanent order records.
At the same time, active basket data must remain cleanly separated from completed purchase records in OrderingDomainv1.0.0OrderingCreates durable Orders from a buyer's current basket, locks purchase-time pricing, and owns order lifecycle transitions ...Ownercommerce-fulfillment-teamDiagramOpen docs and must never become a second, out-of-date copy of BookEntityv1.0.0BookCanonical sellable title in the product catalog, encapsulating descriptive metadata, pricing, stock availability, taxono...Ownercatalog-experience-teamOpen docs information owned by CatalogDomainv1.0.0CatalogCore BookWorm subdomain that makes books discoverable, purchasable, and consistently described across the customer journ...Ownercatalog-experience-teamDiagramOpen docs. Keeping these boundaries clear allows each business area to manage its own data lifecycle independently.
2. Business Value
- Fast storefront responsiveness: Keeps cart updates snappy for shoppers, reducing friction before checkout.
- Clear domain ownership: Prevents temporary cart edits from interfering with confirmed orders, payment records, or fulfillment workflows.
- No duplicate catalog data: Eliminates the risk of stale product details or pricing mismatches being stored inside active carts.
- Clean service boundaries: Allows teams working on shopping, catalog, and ordering capabilities to evolve independently as long as they honor published service contracts.
3. How It Works
Active customer baskets are stored in a dedicated, high-speed in-memory store rather than a permanent order database. Only the cart service manages this store, keeping each customer’s active BasketEntityv1.0.0BasketCustomer-scoped, mutable pre-order collection of requested books and quantities managed prior to checkout.Ownercommerce-fulfillment-teamOpen docs separate using their customer identity.
The basket records only the customer’s current item selections and requested quantities—it never stores a checkout-time price snapshot, payment status, or fulfillment record. Once an order is placed, OrderingDomainv1.0.0OrderingCreates durable Orders from a buyer's current basket, locks purchase-time pricing, and owns order lifecycle transitions ...Ownercommerce-fulfillment-teamDiagramOpen docs becomes the owner of the confirmed purchase, and the temporary basket can be cleared without affecting the order. All other systems interact with the basket through published cart service contracts instead of accessing the underlying database directly.
4. Trade-offs & Lessons Learned
- Hard availability dependency: Because active baskets live in this dedicated store, its availability directly affects whether customers can view or edit their carts.
- Transient data expectations: Losing the basket store can discard active shopping intent, so operational recovery procedures must never confuse restoring temporary baskets with recovering confirmed customer orders.
- Retention policy alignment: Marking the store as transient does not automatically define how long idle baskets should remain before expiring; deployment and eviction settings must be aligned with product retention requirements.
- Strict encapsulation: Other systems must integrate only through the cart service’s published contracts rather than reading or writing the store directly, preventing tight coupling and accidental data corruption.
5. Technical Reference
- Authoritative store: Basket DatabaseContainerv1.0.0Basket DatabaseAuthoritative Redis key-value store owned by the Shopping bounded context for customer-scoped pre-checkout shopping bask...Ownercommerce-fulfillment-teamDiagramOpen docs (implemented with Redis;
retention: transient). - Sole reader/writer: 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, accessing baskets via customer-scoped keys derived from the customer identity.
- Ownership boundaries:
- Cart SystemSystemv1.0.0Cart SystemInternal system that owns customer-scoped baskets throughout the pre-order journey, including basket management, Catalog...Ownercommerce-fulfillment-teamDiagramOpen docs / 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: active customer BasketEntityv1.0.0BasketCustomer-scoped, mutable pre-order collection of requested books and quantities managed prior to checkout.Ownercommerce-fulfillment-teamOpen docs selections and quantities.
- OrderingDomainv1.0.0OrderingCreates durable Orders from a buyer's current basket, locks purchase-time pricing, and owns order lifecycle transitions ...Ownercommerce-fulfillment-teamDiagramOpen docs: accepted Orders, checkout-time purchase snapshots, payment, and fulfilment.
- CatalogDomainv1.0.0CatalogCore BookWorm subdomain that makes books discoverable, purchasable, and consistently described across the customer journ...Ownercatalog-experience-teamDiagramOpen docs: BookEntityv1.0.0BookCanonical sellable title in the product catalog, encapsulating descriptive metadata, pricing, stock availability, taxono...Ownercatalog-experience-teamOpen docs metadata and prices.
- Integration rule: Other systems must consume 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 contracts rather than reading or writing Redis directly.
- Operational note: Deployment expiry and eviction policies must be explicitly configured to match product basket-retention expectations.