Basket Database
Authoritative Redis key-value store owned by the Shopping bounded context for customer-scoped pre-checkout shopping baskets.
Purpose & Ownership Boundary
Basket Database is the authoritative Redis key-value store owned exclusively by 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 in the Shopping bounded context. Redis was chosen for low-latency, customer-scoped key-value persistence of ephemeral pre-checkout BasketEntityv1.0.0BasketCustomer-scoped, mutable pre-order collection of requested books and quantities managed prior to checkout.Ownercommerce-fulfillment-teamOpen docs state without requiring a relational SQL database, while delegating product metadata to Catalog APIServicev1.0.0Catalog APIInternal HTTP and gRPC service for Catalog product management, hybrid discovery, and authoritative book metadata. PublishesBookUpdatedRatingFailedIntegrationEventSubscribesCreatePublisher, UpdatePublisher +24APIsOpenAPI, AsyncAPIOwnercatalog-experience-teamDiagramRepositoryOpen docs and accepted orders to Order APIServicev1.0.0Order APIAuthenticated Ordering service for Buyer profiles and the Order lifecycle, creating Orders from baskets, snapshotting pr...PublishesGetBasketGrpc, GetBookGrpc +5SubscribesCreateOrder, CompleteOrder +11APIsOpenAPI, AsyncAPI, Carrier Service LevelsOwnercommerce-fulfillment-teamDiagramRepositoryOpen docs.
Data Store Profile
| Property | Value |
|---|---|
| Bounded Context / Owner | Shopping — Commerce Fulfillment TeamTeamCommerce Fulfillment TeamStream-Aligned team owning customer shopping baskets, checkout coordination, order lifecycle, and financial saga orchest...Open docs |
| Engine / Technology | Redis (Azure Managed Redis in cloud; Redis container locally) |
| Store Type | Database (Key-Value) |
| Primary Writer(s) | 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 |
| Primary Reader(s) | 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 |
| Authoritative / Source of Truth | Yes (for active pre-checkout baskets) |
| Data Classification | Internal |
| Retention / TTL Policy | Transient (persisted until replaced, explicitly deleted, or cleared after checkout) |
Logical Data Layout & Key Patterns
| Key Pattern | Stored Data | TTL / Eviction | Invalidation / Update Trigger |
|---|---|---|---|
basket:{userId} | UTF-8 JSON BasketEntityv1.0.0BasketCustomer-scoped, mutable pre-order collection of requested books and quantities managed prior to checkout.Ownercommerce-fulfillment-teamOpen docs containing customer id (uuid) and non-empty Basket ItemEntityv1.0.0Basket ItemChild entry within a Basket pairing a Catalog book identifier with a positive requested quantity.Ownercommerce-fulfillment-teamOpen docs array (id, quantity) | No explicit TTL set; persists until mutated or deleted | Full-document atomic replacement (SET) on basket updates; deleted (DEL) by customer request or post-checkout Place orderCommandv1.0.0Place orderShared Finance order-placement command consumed by Notification to render
and submit a new-order email.
Ownerplatform-engineering-teamSchemaDiagramOpen docs cleanup. |
| Integration idempotency keys | 24-hour Kafka message deduplication markers | 24 hours | Automatic TTL expiration after consumer processing. |
Note: Neither the Aspire Redis configuration nor the generated Azure Redis templates declare an explicit eviction policy; verify any externally configured memory-pressure eviction policy before assuming indefinite idle retention.
Consistency, Isolation & Security Guardrails
- No duplicated catalog metadata: Titles, descriptions, and prices are never stored in Redis; 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 enriches items from Catalog APIServicev1.0.0Catalog APIInternal HTTP and gRPC service for Catalog product management, hybrid discovery, and authoritative book metadata. PublishesBookUpdatedRatingFailedIntegrationEventSubscribesCreatePublisher, UpdatePublisher +24APIsOpenAPI, AsyncAPIOwnercatalog-experience-teamDiagramRepositoryOpen docs over gRPC at read time.
- Full-set replacement & invariants: Basket updates atomically overwrite the complete item list and enforce a non-empty basket invariant (empty baskets are deleted rather than stored).
- Not a record of accepted orders: Once checkout completes, Order APIServicev1.0.0Order APIAuthenticated Ordering service for Buyer profiles and the Order lifecycle, creating Orders from baskets, snapshotting pr...PublishesGetBasketGrpc, GetBookGrpc +5SubscribesCreateOrder, CompleteOrder +11APIsOpenAPI, AsyncAPI, Carrier Service LevelsOwnercommerce-fulfillment-teamDiagramRepositoryOpen docs persists the immutable purchase in Order DatabaseContainerv1.0.0Order DatabaseAuthoritative PostgreSQL system of record owned by the Ordering bounded context for buyers, accepted orders, purchase-ti...Ownercommerce-fulfillment-teamDiagramOpen docs, and post-checkout cleanup publishes Basket deletion completedEventv1.0.0Basket deletion completedIndicates that Basket successfully deleted the submitted basket during checkout cleanup. Ownercommerce-fulfillment-teamSchemaDiagramOpen docs or Basket deletion failedEventv1.0.0Basket deletion failedIndicates that Basket could not delete the submitted basket during checkout cleanup. Ownercommerce-fulfillment-teamSchemaDiagramOpen docs.
Shared Redis Key-Prefix & Flush Isolation: Basket Database shares the redis cluster with Catalog CacheContainerv1.0.0Catalog CacheNon-authoritative FusionCache and Redis caching layer owned by the Catalog bounded context for fast book detail lookups ...Ownercatalog-experience-teamDiagramOpen docs, Order Cache and Distributed LocksContainerv1.0.0Order Cache and Distributed LocksRedis-backed coordination and caching slice owned by the Ordering bounded context for buyer-scoped creation locks, HTTP ...Ownercommerce-fulfillment-teamDiagramOpen docs, Rating CacheContainerv1.0.0Rating CacheNon-authoritative FusionCache and Redis caching layer owned by the Reviews bounded context for AI-generated book feedbac...Ownercatalog-experience-teamDiagramOpen docs, and Notification idempotency markers. Because basket:{userId} is authoritative for active pre-checkout carts, flushing the shared Redis instance permanently drops all active customer baskets alongside cached responses and distributed locks. Only 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 may read or write basket:* keys.
Operational & Resilience Notes
- Local vs. Cloud: Local development runs a persistent single-container Redis instance with
RedisInsight; cloud environments run Azure Managed Redis (
BalancedB0in Dev,BalancedB1with HA in Staging,BalancedB5with HA in Production). - Failure impact: If a post-checkout delete fails, 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 emits Basket deletion failedEventv1.0.0Basket deletion failedIndicates that Basket could not delete the submitted basket during checkout cleanup. Ownercommerce-fulfillment-teamSchemaDiagramOpen docs so Order OrchestrationServicev1.0.0Order OrchestrationMessage-driven Finance workflow service that coordinates post-checkout basket cleanup and order notifications using Dura...PublishesPlaceOrderCommand, DeleteBasketCompleteCommand +3SubscribesUserCheckedOutIntegrationEvent, OrderStatusChangedToCompleteIntegrationEvent +3APIsAsyncAPIOwnercommerce-fulfillment-teamDiagramRepositoryOpen docs can trigger compensation.
Architecture Visualizations
Loading graph...
Related Documentation
- 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 — Owning service REST/gRPC endpoints, authorization, and Kafka handlers.
- Order DatabaseContainerv1.0.0Order DatabaseAuthoritative PostgreSQL system of record owned by the Ordering bounded context for buyers, accepted orders, purchase-ti...Ownercommerce-fulfillment-teamDiagramOpen docs — Authoritative PostgreSQL store for confirmed purchases after checkout.
- Order Cache and Distributed LocksContainerv1.0.0Order Cache and Distributed LocksRedis-backed coordination and caching slice owned by the Ordering bounded context for buyer-scoped creation locks, HTTP ...Ownercommerce-fulfillment-teamDiagramOpen docs — Sibling logical workload on the shared Redis resource.
- ADR-001: Use Redis as the authoritative basket storeDecision Recordv1.0.0ADR-001: Use Redis as the authoritative basket storeRedis is the authoritative store for active customer baskets, while accepted orders and Catalog data remain owned by the...Ownercommerce-fulfillment-teamOpen docs — Decision adopting Redis as the authoritative basket store.
- ADR-004: Enrich basket items from Catalog at read timeDecision Recordv1.0.0ADR-004: Enrich basket items from Catalog at read timeBasket persistence stores book references and quantities, while current book presentation data is resolved from Catalog ...Ownercommerce-fulfillment-teamOpen docs — Decision to enrich basket items at read time instead of caching prices.
- Backup, Restore & Disaster Recovery (DR)Custom DocBackup, Restore & Disaster Recovery (DR)Operator runbook for PostgreSQL point-in-time restore, Cosmos DB failover verification, Blob Storage recovery, and Qdran...Ownerplatform-engineering-teamOpen doc — Platform backup, restore, and disaster recovery runbook.