Mark bounded contexts
Mark subdomain types and bounded contexts, say how the contexts relate, and see the context map they make. The guide grows one small model, a shop, a step at a time, and every step is a whole model that builds with no error or lint: type it into model/ in a repository kq init made, and check it with kq validate or in VS Code as you type. Every statement used here is described in full in Domain-driven design.
Type your subdomains
core, supporting or generic after a domain's name states its subdomain type: core where the business competes, supporting for what is specific to it but not what it competes on, generic for a solved problem every business has. A sub-domain stating none takes its nearest typed parent's.
The shop competes on how it sells, runs a catalog of its own and takes payments as every shop does:
A domain is what domain-driven design calls a subdomain, a part of the problem space. See Subdomain types and bounded contexts.
Mark the bounded contexts
bounded-context, written last, marks a domain a bounded context: the boundary of one model and the language naming it. Kanoniq never guesses one. A component is in the context marked on a domain at or above its primary domain, and contexts don't nest: a component is in at most one, KQ095. Mark the three domains, and add a component that realizes each:
Each component is now in the context of the domain it realizes. The payment gateway is saas because a generic subdomain is usually bought: a generic domain realized by custom-built software is KQ113. See Subdomain types and bounded contexts.
Say how the contexts relate
Two contexts are joined wherever something crosses between them: a call, a message through a channel, or a copy of data. For a call, the context of the component the API belongs to is upstream, and the caller's is downstream. A line in a context's block states how it relates to another, in domain-driven design's terms: customer-of, written in the downstream context, says the other plans for its needs. The order service calls the catalog, and Selling is Catalog's customer:
Which way the integration runs is not written. Kanoniq reads it from the calls, channels and copies of data between the two, and reports a line they contradict, such as a relationship with nothing crossing, KQ207. See Relationships between contexts.
Mark an open host
open-host after an API's name marks it an open host service, a protocol offered to every bounded context, and published-language after it says what travels on it is a documented, shared language. Both need the name, so declare the API the connection created, in the catalog service:
published-language is legal only beside open-host, KQ211. See The context map.
See what you modeled
The context map view answers which of an ecosystem's bounded contexts depend on which, and the patterns between them: each context a box, upstream above downstream, and each pattern written at its end. The shop's, drawn from the last step:
The diagram in words
Shop · Context map
Contexts
- Selling (Domain · Core): 1 component
- Catalog (Domain · Supporting): 1 component
- Payments (Domain · Generic): 1 component
Lines
- Catalog → Selling: upstream to downstream, upstream OHS, PL, S, downstream C
In VS Code, the viewer draws it as you type. See Context map.
Where next
- Model integration: the calls and messages that cross between contexts.
- Model the data: which context holds the authoritative copy.
- Model the applications: the components each context is made of.
© 2026 Extenza Works. All rights reserved.