Skip to content

Subdomains and bounded contexts

Subdomains describe the business areas; bounded contexts are the parts of the system with their own model and vocabulary, and implement subdomains.

Subdomains

A subdomain is an area of the business: Ordering, Payments, Identity. Give it a summary, a description and a classification. The Subdomains page lists them by classification.

ClassificationMeaning
CoreWhere you compete.
SupportingNeeded, and specific to you.
GenericSolved problems you could buy.
UnclassifiedUntil you decide.

Bounded contexts

A bounded context is a part of the system with its own model and language: Orders, Billing, Catalog. It has a summary (500 characters at most), a description, an icon and a colour for its card, the subdomains it implements and its context map. A subdomain shows the contexts that implement it.

A context page has five tabs:

TabWhat it shows
OverviewSummary, description, implemented subdomains and the context map.
ModelIts aggregates, value objects and enums, and the data contracts, read models and integration events that belong to it.
BehaviourIts use cases, event handlers and scheduled jobs.
TermsThe glossary, filtered to the terms of this context.
DecisionsIts decisions and constraints, in two sections.

The context map

A bounded context lists the contexts it depends on, in its upstreams: each entry names a context, a pattern and an optional note, such as "Payments publishes PaymentCaptured". On the Overview tab, Add to context map opens the picker.

PatternsWhat they mean
customer-supplier, conformist, anti-corruption-layer, open-host-service and published-languageThis context is downstream of the context it names.
shared-kernel, partnership and separate-waysThe two contexts are peers, with no up or down side. Declare it on either side, or both.
  • A context lists another context once, and never itself.
  • When two contexts list each other in ways that do not match, both get a warning (context-map-mismatch) naming the other context.
  • The Overview tab also shows, read only, the contexts Downstream of this one and its Peers.
  • The System map draws the declared relations, labelled with their pattern, next to the ones it derives from references.

Where the boundaries go

Draw a context boundary where one of these is true:

  • A word changes meaning: an Order in Orders is not an Order in Fulfilment.
  • A team owns the code.
  • A model must stay consistent inside and may lag outside.

Data contracts and integration events are how contexts talk; see Data contracts, read models and integration events. The context map says who depends on whom.

Moving an artefact to another context

Changing the context of an aggregate, value object or enum moves it. Its id and every reference to it stay.

Next steps