Context map in DDD

A Context Map is a strategic DDD artifact that shows bounded contexts and the relationships between them (upstream/downstream, integration style, and inter-team agreements).

Key patterns

  • Customer–Supplier (C/S): Downstream sets requirements; upstream delivers.
  • Conformist (CF): Downstream conforms to upstream’s model as-is.
  • Anti-Corruption Layer (ACL): Translation layer to protect downstream from upstream model.
  • Shared Kernel (SK): Teams share a subset of the model and code.
  • Open Host Service (OHS) + Published Language (PL): Upstream exposes a stable API and shared language.
  • Partnership (P): Teams collaborate closely; mutual influence.
  • Separate Ways (SW): Teams intentionally don’t integrate.
flowchart LR
  Auth["Auth BC"] -- "OHS/PL" --> App["App BC"]
  Legacy["Legacy BC"] -- "ACL" --> App
  App -- "C/S" --> Billing["Billing BC"]
  Content["Content BC"] -- "CF" --> App
  Search["Search BC"] ---|"SK"| Reco["Recommendations BC"]
  Marketing["Marketing BC"] <-->|"P"| Sales["Sales BC"]

  classDef ctx fill:#f6f8fa,stroke:#d0d7de,color:#24292f;
  class Auth,App,Legacy,Billing,Content,Search,Reco,Marketing,Sales ctx;

Notes

  • Upstream/Downstream matters: downstream adapts to upstream’s model unless protected (e.g., ACL) or empowered (C/S).
  • Prefer OHS/PL for stable integrations; use ACL at boundaries to legacy systems.
  • Minimize shared kernels and use them deliberately; they increase coupling.

See also

  • Domain-Driven Design
  • Bounded Context
  • Context Map
  • Anti-Corruption Layer