Skip to main content

Subdomain classification

Shopping Cart is a Supporting subdomain (area Storefront, tier storefront, business model conversion, evolution custom-built). The classification is the aggregator's verdict; this page gives the reasoning from the code and copies the neighbours' classes from warehouse-docs (storefront Subdomain Classification, network Subdomain Classification).

Why Supporting​

Domain-Driven Design classifies by competitive advantage, not by size or difficulty.

  • A shopper does not choose a storefront for its cart, but a broken cart loses the sale. It must work; working is not the differentiator. That is the definition of Supporting.
  • Moderate model complexity. One aggregate (Cart, internal/domain/cart), four states, and rules that are not CRUD: the delivery quote carries a foreign lifecycle (offers expire by the network's clock, so readiness is derived from now, never stored), one clearing rule ("any line or destination change clears the quote and the selections") touches every mutating command, and correctness depends on two upstream feeds (ErrItemNotPurchasable is only as current as rm_items, the estimate only as current as the schedule and tax table).
  • Moderate differentiation. The quote-and-selection shape, one group per shipment with an offer per tier and a window and expiry each, is specific to this network's promise model, and no off-the-shelf cart holds it. The differentiated parts of the money story, the price of speed and the binding total, are not here: the cart's estimate is explicitly labelled non-binding, and the binding total is the checkout session's price quote from pricing.
  • Plumbing is commodity. The outbox, inbox, CloudEvents envelope, idempotency keys and the 30-day abandonment sweep are the fleet's standard building blocks.
  • Evolution: custom-built. Holding the network's per-group offers with clearing semantics is this design's shape; the purchasability and estimate views are projections negotiated with the events of other contexts, not a product to buy.

What would move it: promotions inside the estimate (a later phase) would raise its complexity before becoming their own context; a deferred identity context would formalise the guest-first shopperId and merge handling the cart now owns.

Problem space: the storefront subdomains​

Copied from warehouse-docs storefront/docs/strategic-design/subdomain-classification.md (origin/main):

SubdomainWhat the business must be good atVerdict
Pricing & Delivery ChargesItem prices, sale windows, the price of speed per tier, a binding total at purchaseCore
Product DiscoveryFinding the right purchasable item fastSupporting
CartHolding intent, delivery quote and tier choice per shipment groupSupporting
CheckoutOne purchase transaction across price, payment and the network's promise confirmationSupporting
Product ContentDescriptions, media, attributes, categories for an item the network already knowsGeneric
Customer PaymentsAuthorize, capture, release, refund through a payment providerGeneric
Customer IdentitySign-in, credentialsGeneric, deferred
Notifications / Returns / Promotions / Reviews / Recommendations-Later

Solution space: the storefront bounded contexts​

Bounded contextClassificationTierBusiness modelEvolution
pricingCorestorefrontRevenueCustom-built
product-contentGenericstorefrontEngagement enablerCommodity
product-discoverySupportingstorefrontConversion enablerCustom-built
shopping-cartSupportingstorefrontConversion (holding intent without losing the total-cost-up-front rule)Custom-built
checkoutSupportingstorefrontConversion (the purchase transaction)Custom-built
customer-paymentsGenericstorefrontRevenue collectionCommodity

The aggregator counts 3 Supporting, 2 Generic and 1 Core among the six.

The cart's neighbours​

Only the contexts this service has an edge with (see Integration and Context map):

NeighbourAreaClassificationEdge with the cart
pricingStorefrontCoreupstream: Kafka events feed the price, schedule and tax views
checkoutStorefrontSupportingreads the cart over REST; announces CheckoutCompleted
offer-availabilityNetwork (commerce)Supportingupstream: Kafka catalogue events
delivery-promiseNetwork (commerce)Coreupstream: the one synchronous REST call, QuoteDeliveryOffers
storefront-bffExperiencenot a bounded contextthe shopper-facing caller of the REST routes

customer-ordering (Generic, network) and product-content (Generic) have no edge with the cart: the cart never calls the former, reaching it is checkout's job, and it consumes no content events.