skip to content

In Domain-Driven Design, what is a context map, and what three things does it typically show about a system made up of multiple bounded contexts?

level: juniorimportance: must knowfreq 70%

answer

  1. nodes = contexts, edges = integrations
  2. U/D = who adapts to whom
  3. team ownership on each box
  4. workshop-drawn, cross-team
  5. strategic, not tactical, level

basics

~10 s

A context map is a diagram showing all the bounded contexts in a system, how they connect, which one leads (upstream) vs follows (downstream), and which teams own each one.

solid answer

~40 s

A context map is the single diagram that shows the full topology of a system's bounded contexts: every context that exists, the integration points between them, the upstream/downstream direction of each relationship, and which team owns which context. It's drawn at the strategic-design level, above individual services or classes — it doesn't describe internals of any one context, only how contexts relate to each other. It's typically produced collaboratively (whiteboard session, EventStorming-style workshop) because no single person usually knows the whole system, especially once teams have specialized. The map is a communication and coordination tool, not code — it makes implicit assumptions about who depends on whom explicit, and surfaces organizational relationships alongside the technical integration.

go deeper

for a junior

Should recognize a context map as a diagram of bounded contexts and their connections, and be able to read one to find which context owns a given piece of data or behavior; not expected to lead drawing one.

for a middle

Can contribute accurately to an existing context map for the contexts they work in, correctly identify upstream/downstream for relationships they build, and flag when the map disagrees with what the code actually does.

for a senior

Can facilitate a cross-team mapping workshop, drive out U/D direction and ownership for ambiguous edges, and is responsible for keeping the map for their area current as integrations change.

for a principal

Uses the context map as a lever for organization-wide decisions — where to invest in decoupling, which team boundaries to redraw — and ensures mapping practice itself stays alive across many teams, not just one.

## What a context map is A context map is the artifact in Domain-Driven Design's strategic design toolkit that shows the complete topology of a system: - **every bounded context** that exists - **how they are connected** - **which direction of influence** runs across each connection - **which team is accountable** for each piece Where a single bounded context's internal model is described by an ubiquitous language and a domain model, the context map operates one level up — it says nothing about the classes or tables inside any one context, and everything about how the contexts relate to each other as **black boxes**. ## How one actually gets drawn Mechanically, building one starts by inventorying every bounded context that currently exists (or is planned), which typically requires talking to every team rather than relying on a single architect's mental model, since in any organization past a certain size no individual has accurate knowledge of every integration. For each pair of contexts that actually exchange information, the team draws an edge and labels it with an **upstream/downstream** (`U/D`) designation. The information exchange might be: - a REST call - a published event - a shared database table - a nightly batch export Determining direction is done by asking a single diagnostic question: **which side has to change its model to accommodate the other?** The context whose model the other side must adapt to is **upstream**; the one that adapts is **downstream**. This is often as much an organizational fact as a technical one — the team with more leverage, an earlier deadline, or ownership of a widely-consumed platform tends to become upstream by default, whether or not that's the technically ideal arrangement. ## Why the artifact exists The reason this artifact exists is that integration knowledge, left implicit, doesn't scale past a handful of teams. Each bounded context can be designed with perfect internal consistency and still produce a system that fails, because bounded-context-level design says nothing about the **seams** between contexts — and it's precisely at those seams that most large-system defects, miscommunications, and unplanned coupling occur. A context map forces those seams to be enumerated and named in one place any engineer, new hire, or manager can consult, rather than living as tribal knowledge scattered across chat threads and the memories of whoever built the original integration. ## The trade-off The main trade-off is the cost of producing and — more importantly — maintaining the map against the value of the shared understanding it buys. - Drawing a context map is **genuinely useful up front** on a system with several teams, because it lets teams negotiate contracts before any code is written, which is cheaper than renegotiating after the fact. - But **it is easy to over-invest**: spending weeks producing an exhaustive map before writing a line of code delays feedback and often documents assumptions that turn out wrong once real integration work starts. The map's value is proportional to how current it stays, not how detailed it originally was. ## Failure modes That maintenance cost is also the map's principal failure mode. 1. **Drift.** A context map drawn once during a kickoff and never revisited drifts from reality as contexts split, merge, or grow new integration points — and a stale map is arguably worse than no map, because it creates false confidence. A team that trusts an outdated map may believe an integration doesn't exist, ship a breaking change, and only discover the real coupling when production breaks. 2. **The wrong granularity.** A related failure is drawing the map at the wrong granularity: too fine (one box per microservice or table) turns it into an architecture diagram that obscures the model boundaries it's supposed to reveal; too coarse (one box for an entire department) hides exactly the seams the exercise exists to surface. 3. **The wrong room.** A third failure is drawing the map without the engineers who actually build the integrations in the room — architects sketching a map from documentation alone routinely miss the informal, undocumented channels that are often where the real coupling and the real incidents live. ## Putting it on one page A concrete example: an e-commerce platform with separate Order Management, Inventory, Shipping, and Billing contexts might have a context map showing: - **Order Management upstream of Shipping** — Shipping conforms to the schema of an `OrderPlaced` event Order Management publishes. - **Inventory upstream of Order Management** — for a synchronous stock-reservation call. Drawing that map in one place lets a new engineer, or a leader deciding where to add headcount, see the whole system's shape at a glance — something no individual context's documentation could provide on its own.

  • Who should be in the room when a team draws its first context map?
    Representatives from every team that owns a context being mapped, not just architects — direction and relationship type are often organizational facts that only the implementing teams actually know, and architects working from documentation alone routinely miss undocumented integration channels.
  • How do you decide the right granularity for boxes on the map — one per bounded context, per microservice, or per team?
    One box per bounded context. Multiple microservices that share a database or are only ever deployed and evolved together as one team's implementation detail usually belong inside a single bounded context, so mapping at the service level turns the diagram into a deployment topology and hides the model boundaries the exercise is meant to reveal.
  • What's the practical difference between a context map and a general system architecture diagram?
    An architecture diagram documents technical components, deployment units, and infrastructure; a context map documents model boundaries, direction of influence, and team ownership. The same system can have one architecture diagram and a context map that looks quite different, because several architecturally separate services can sit inside one bounded context, or vice versa.

A context map is like a subway map for a city — it doesn't show what's inside each station (that's the internal model of a bounded context), only which lines connect which stations and which direction the trains run.

saying these in an interview costs you the question

  • Draws boxes around deployed services or databases instead of bounded contexts / model boundaries
  • Can't say, for any edge on their own map, which side is upstream and which is downstream
  • Treats the map as a one-time deliverable produced once and never revisited
  • Includes internal implementation detail of a single context rather than only its relationships to others
  • Drew the map alone or with only architects, without input from the teams actually building the integrations

context