Basket
Customer-scoped, mutable pre-order collection of requested books and quantities managed prior to checkout.
Domain Role & Boundary
Basket is the Aggregate Root in the ShoppingDomainv1.0.0ShoppingCoordinates the customer basket and pre-purchase checkout intent, from selecting books through handing an accepted purch...Ownercommerce-fulfillment-teamDiagramOpen docs bounded context representing an authenticated customer’s mutable pre-purchase selection of books. Owned 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, it provides sub-millisecond read and write access during storefront browsing and supplies checkout snapshots 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. It explicitly does not own product pricing or availability (resolved dynamically from CatalogDomainv1.0.0CatalogCore BookWorm subdomain that makes books discoverable, purchasable, and consistently described across the customer journ...Ownercatalog-experience-teamDiagramOpen docs), inventory reservations, or accepted purchase records (owned by OrderingDomainv1.0.0OrderingCreates durable Orders from a buyer's current basket, locks purchase-time pricing, and owns order lifecycle transitions ...Ownercommerce-fulfillment-teamDiagramOpen docs).
Entity Profile
| Property | Value |
|---|---|
| Bounded Context / Domain | ShoppingDomainv1.0.0ShoppingCoordinates the customer basket and pre-purchase checkout intent, from selecting books through handing an accepted purch...Ownercommerce-fulfillment-teamDiagramOpen docs |
| Owning Service | 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 |
| DDD Role | Aggregate Root |
| Identifier Strategy | Authenticated customer ID (GUID-formatted string, derived from access token) |
| Persistence Store | Shopping key-value store (basket:{customerId}, no SQL database) |
| Deletion Semantics | Hard-delete (customer clear or idempotent post-checkout cleanup; no automatic TTL) |
| Concurrency Control | Last-write-wins with whole-set replacement; idempotent message handling on cleanup |
| PII / Data Classification | Internal customer-scoped identifier (customerId only; no names or addresses stored) |
Attributes & Constraints
| Name | Type | Required | Description | Reference |
|---|---|---|---|---|
| customerId | string | required | Authenticated customer identifier scoping the basket (one active basket per customer). | — |
| items | basket-item[] | required | Requested book entries, replaced atomically as a complete set on update. | basket-itemProperty: bookId |
| createdAt | datetime | required | UTC timestamp when the basket was created. | — |
| lastModifiedAt | datetime | optional | UTC timestamp of the most recent basket update. | — |
| Attribute | Business Rule / Constraint | Sensitivity / Notes |
|---|---|---|
customerId | Required; derived strictly from the authenticated customer token (one basket per customer). | Customer-scoped key |
items | Required; must contain at least one Basket ItemEntityv1.0.0Basket ItemChild entry within a Basket pairing a Catalog book identifier with a positive requested quantity.Ownercommerce-fulfillment-teamOpen docs on create and update at the API boundary. | Whole-set replacement |
createdAt, lastModifiedAt | UTC audit timestamps serialized with the basket payload. | Metadata |
Domain Invariants & Lifecycle
- Authenticated ownership: A basket always belongs to a single authenticated customer; anonymous baskets are not persisted.
- Non-empty creation and update: Creating or updating a basket via the API requires at least one valid Basket ItemEntityv1.0.0Basket ItemChild entry within a Basket pairing a Catalog book identifier with a positive requested quantity.Ownercommerce-fulfillment-teamOpen docs. To empty a basket, the customer explicitly deletes it.
- Whole-set replacement: Updating a basket replaces the entire
itemscollection rather than merging partial line-item diffs. - Post-checkout cleanup: Upon receiving Place orderCommandv1.0.0Place orderShared Finance order-placement command consumed by Notification to render and submit a new-order email. Ownerplatform-engineering-teamSchemaDiagramOpen docs from 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, 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 deletes the basket idempotently and 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.
A basket represents mutable shopping intent—never a confirmed order or an inventory hold. If a basket fails to delete after checkout, OrderingDomainv1.0.0OrderingCreates durable Orders from a buyer's current basket, locks purchase-time pricing, and owns order lifecycle transitions ...Ownercommerce-fulfillment-teamDiagramOpen docs compensates rather than allowing stale basket state to be misread as an active order.
Relationships & Associated Operations
| Category | Resource | Role / Interaction |
|---|---|---|
| Related Entities | Basket ItemEntityv1.0.0Basket ItemChild entry within a Basket pairing a Catalog book identifier with a positive requested quantity.Ownercommerce-fulfillment-teamOpen docs | Embedded collection of requested books and quantities |
| Cross-Context References | BookEntityv1.0.0BookCanonical sellable title in the product catalog, encapsulating descriptive metadata, pricing, stock availability, taxono...Ownercatalog-experience-teamOpen docs, OrderEntityv1.0.0OrderDurable purchase record owned by a Buyer, capturing immutable purchase-time line items and governing order lifecycle tra...Ownercommerce-fulfillment-teamOpen docs | Items reference Catalog books; checkout hands off to Ordering |
| Mutating Commands | Create basketCommandv1.0.0Create basketCreates a basket containing the supplied item identifiers and quantities.Ownercommerce-fulfillment-teamSchemaDiagramOpen docs, Update basketCommandv1.0.0Update basketReplaces a basket's item collection with the supplied items.Ownercommerce-fulfillment-teamSchemaDiagramOpen docs, Delete basketCommandv1.0.0Delete basketDeletes the current basket.Ownercommerce-fulfillment-teamSchemaDiagramOpen docs, Place orderCommandv1.0.0Place orderShared Finance order-placement command consumed by Notification to render and submit a new-order email. Ownerplatform-engineering-teamSchemaDiagramOpen docs | Create, replace, or delete the customer’s basket |
| Read Queries | Get basketQueryv1.0.0Get basketReturns the current basket and its item details.Ownercommerce-fulfillment-teamSchemaDiagramOpen docs, Get basket over gRPCQueryv1.0.0Get basket over gRPCReturns the current basket through the basket.v1 gRPC contract.Ownercommerce-fulfillment-teamSchemaDiagramOpen docs | Enriched storefront read and internal checkout snapshot |
| Emitted Events | Basket deletion completedEventv1.0.0Basket deletion completedIndicates that Basket successfully deleted the submitted basket during checkout cleanup. Ownercommerce-fulfillment-teamSchemaDiagramOpen docs, Basket deletion failedEventv1.0.0Basket deletion failedIndicates that Basket could not delete the submitted basket during checkout cleanup. Ownercommerce-fulfillment-teamSchemaDiagramOpen docs | Report post-checkout cleanup outcome to Finance |