Skip to main content

Context map

The BFF's slice of the fleet map, in the ddd-crew Context Mapping notation. On every edge U is upstream and D downstream; the pattern names how the downstream relates to the upstream's model: OHS Open Host Service, PL Published Language, CF Conformist, ACL Anti-Corruption Layer, C/S Customer/Supplier. All edges are synchronous REST; there is no Kafka edge. The fleet-wide map is in the aggregator: storefront context map.

Source: internal/domain/composition/allowlist.go (which upstream routes exist), internal/adapters/outbound/rest/client.go, apis/openapi.yaml, the neighbour classes in the aggregator's strategic design, and the patterns in the Every edge table below. Arrows point from upstream to downstream.

Every edge​

UpstreamDownstreamPatternContract the BFF depends onEvents
storefront-bffstorefront-webC/S (the BFF supplies, the web app is the customer; the BFF's OpenAPI is the contract)apis/openapi.yaml, 23 routesnone
product-discoverystorefront-bffCF + OHSGET /products, GET /products/{id}, GET /categoriesnone
delivery-promisestorefront-bffCF + OHS / PLPOST /delivery-quotes (the quote contract is open to any client)none
pricingstorefront-bffCFGET /delivery-charge-schedules/currentnone
shopping-cartstorefront-bffCFnine cart routesnone
checkoutstorefront-bffCFopen, read, confirmnone
customer-orderingstorefront-bffCF + OHSorders, tracking, cancel, shoppers, addressesnone

Edges that do not exist, and are kept from existing by tests:

EdgeWhy not
storefront-bff to customer-payments or any payment providercheckout owns authorisation; the BFF only forwards a PSP token to it
storefront-bff to network restricted routes (GET /orders/{id}/ship-to, POST /promises, promise confirmations and cancellations, POST /inventory-feeds, policy routes)the storefront is in-org with the retail network but may call only the Open Host Service routes; TestNoInOrgNetworkRoute and TestAllowlistHoldsNoRestrictedRoute
storefront-bff to Kafkano topic is produced or consumed
any network context to storefront-bffthe network never depends on the storefront

Why these patterns​

  • Conformist on every upstream. The BFF relays upstream bodies and problems untouched (ADR 0004 and ADR 0005 say so explicitly): it adopts each upstream's model instead of translating it, which is why a new upstream field reaches the page without a BFF change, except in the two composed routes.
  • No ACL. The only translations are the route verbs (A1 in ADR 0002: a public PATCH becomes the cart's PUT /carts/{id}/lines/{item}) and the composed views; neither renames a domain concept.
  • Open Host on the supplier side. product-discovery, delivery-promise and customer-ordering publish routes meant for shoppers; the BFF stays inside that list.
  • Customer/Supplier toward the web app. The BFF shapes its REST edge for storefront-web (ADR 0004 added GET /categories for the navigation bar), and an upstream contract change surfaces first in the integration tests and in allowlist.go.