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

Read the architecture guide →

Get basket over gRPC

Returns the current basket through the basket.v1 gRPC contract.

Order Lifecycle

GetBasketGrpc invokes the internal basket.v1.BasketGrpcService/GetBasket gRPC unary RPC on 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 to retrieve the authenticated customer’s basket items and quantities. 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 calls this RPC synchronously during order creation using an On-Behalf-Of (OBO) Microsoft Entra ID access token exchanged for Basket API.

Overview

PropertyValue
Bounded ContextShopping
Owner ServiceBasket 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
Protocol / FormatgRPC unary RPC (basket.v1.BasketGrpcService/GetBasket), Protobuf edition = "2023"
Gateway EndpointInternal gRPC RPC basket.v1.BasketGrpcService/GetBasket (not exposed via API Gateway)
Authentication & AuthorizationMicrosoft Entra ID JWT via Authorization: Bearer <token> metadata (customer OBO token with basket_read/basket_write scopes)
Idempotency / ConcurrencyRead-only and naturally idempotent
Rate Limit / CachingPer-user token bucket (30 limit, 20 per 10s, queue 5); backed by Redis
Contract Version1.0.0

Request & Response Contract

Request Message (google.protobuf.Empty)

Empty google.protobuf.Empty message; customer identity is derived from the authenticated gRPC call context.

Success Response (GetBasketResponse)

NameTypeRequiredConstraintsDescription
idstringYesTag 1 (empty string if no basket exists)Basket identifier
itemsItem[]YesTag 2 (repeated; empty list if no basket exists)Items currently stored in the basket
items[].idstringYesTag 1Catalog book identifier
items[].quantityint32YesTag 2Quantity of the book in the basket
Note

When no basket exists in Redis for the authenticated customer, this RPC returns an empty GetBasketResponse (id = "", items = []) rather than NotFound (5). Callers must check items length before proceeding.

Behavior & Side Effects

  • Redis lookup: Reads basket:{userId} directly from Redis without Catalog enrichment.
  • No state mutation: Pure read RPC with no database writes or integration events.

Error Responses

Status / CodeConditionClient Recovery Action
Unauthenticated (16)Missing/invalid Entra ID token or empty user identityExchange a valid customer OBO token for Basket API and retry
PermissionDenied (7)Authenticated principal fails Basket API authorization policyVerify customer role and basket_read/basket_write scopes
ResourceExhausted (8)Caller exceeded per-user rate limitRetry with exponential backoff
Unavailable (14)Basket API or backing Redis instance is unreachableRetry within budgeted resilience policy; fail checkout if unavailable
  • 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 — Service overview, Redis persistence, and endpoints.
  • BasketEntityv1.0.0BasketCustomer-scoped, mutable pre-order collection of requested books and quantities managed prior to checkout.Ownercommerce-fulfillment-teamOpen docs — Basket entity model.
  • Get basketQueryv1.0.0Get basketReturns the current basket and its item details.Ownercommerce-fulfillment-teamSchemaDiagramOpen docs — Public HTTP endpoint that enriches basket items with Catalog details.
  • Create orderCommandv1.0.0Create orderCreates an Order for the authenticated Buyer using the current basket and Catalog pricing.Ownercommerce-fulfillment-teamSchemaDiagramOpen docs — Ordering API checkout flow that calls GetBasket.

Get basket over gRPC schema

4 fields
Package:basket.v1(2023)
Message:GetBasketResponse
idstring= 1
itemsrepeated Item= 2
Message:Item
idstring= 1
quantityint32= 2