Glossary

Domain-Driven Design, functional TypeScript · complete course vocabulary · print it, pin it, use the exact words

The ubiquitous language of this course: every term with its exact meaning and the lesson that introduced it. Lessons link here instead of re-explaining. Terms marked [Evans], [Khononov], or [Wlaschin] are defined authoritatively in those sources — see RESOURCES.md. Companion: patterns cheat sheet.

Ubiquitous language [Evans]
The shared vocabulary of the business and the code: one set of terms used in conversation, documentation, and type/function names. If the business says “order status”, the type is OrderStatus, not state.
Lesson 1
Domain model
The part of the codebase that expresses the business's concepts and rules — as types, pure functions, and invariants — independent of databases, HTTP, and frameworks.
Lesson 1
Value object [Evans]
A concept with no identity, defined entirely by its attribute values; immutable; two instances with equal values are interchangeable. Here: a branded type with a smart constructor.
Lesson 1
Primitive obsession
The smell of modeling domain concepts with raw primitives so their rules live nowhere in the type system and get re-checked (or forgotten) everywhere.
Lesson 1
Branded type
A primitive intersected with a phantom marker so domain types aren't interchangeable, zero runtime cost: type Email = string & { readonly __brand: 'Email' }. The TS translation of Wlaschin's single-case union [Wlaschin].
Lesson 1
Smart constructor
The only function allowed to produce a branded type: checks the rules once and returns a Result. Wherever the type appears, the rules already held.
Lesson 1
Parse, don't validate [King]
Validation checks data and returns booleans, leaving raw data circulating. Parsing converts raw data into richer domain types at the boundary — the type is the proof. Applies to strings, HTTP bodies, database rows, and vendor payloads alike.
Lessons 1, 7, 8
Result <T, E>
The two-case union for fallible operations: { ok: true; value: T } | { ok: false; error: E }. Failure is a value in the signature, handled by narrowing, never a surprise at runtime.
Lesson 1
Invariant
A rule that must be true of a concept at every moment (“total equals the sum of its lines”). Enforced by smart constructors and aggregate transitions — never by hope.
Lessons 1, 3
Entity [Evans]
A concept defined by an identity that persists through state change, not by attribute values. Modeled here as plain frozen data plus a branded id; change is a pure function returning a new value with the same id.
Lesson 2
Identity
The stable reference that makes an entity “the same one” across time and state changes. Identity is itself a branded value object, minted at boundaries and parsed in.
Lesson 2
Aggregate [Evans, Fowler]
A cluster of entities and value objects with a root, treated as one unit, forming a consistency boundary: invariants inside are true instantly after every change. Here: immutable data + one module of pure transition functions returning Result.
Lesson 3
Aggregate root
The entry point of the aggregate. Outside code references the cluster only by the root's id; transitions hang off the root. In Meridian's order aggregate: Order.
Lesson 3
Cross-aggregate reference
Pointing from one aggregate at another by identity only (customerId, never a Customer object). Keeps boundaries small and updates local.
Lesson 3
Anemic domain model [Fowler]
Data-only types whose rules live scattered across handlers and triggers — the failure mode aggregates exist to prevent.
Lesson 3
Illegal states unrepresentable [Wlaschin]
Modeling so that combinations the business forbids cannot be constructed at all — usually a discriminated union with one variant per lifecycle stage, each carrying only its stage's data.
Lesson 4
Discriminant
The literal-typed field (kind: "draft") that lets the compiler narrow a union to one variant. Literal types, always — a string discriminant narrows nothing.
Lesson 4
Exhaustiveness check
The assertNever(x: never) pattern: switching on a discriminant with assertNever as the default makes every unhandled variant a compile error. Adding a stage produces a compiler-generated work list.
Lesson 4
Domain event [Evans, Khononov]
An immutable fact about something that happened, named in past tense (OrderPlaced), emitted only on success, carrying a self-sufficient payload. Transitions return { state, events }; handlers in the shell react.
Lesson 5
Command
A request that something happen (PlaceOrder) — may fail. Contrasted with an event, a fact that already happened (OrderPlaced) — cannot be rejected.
Lesson 5
Handler
A shell function subscribed to an event type, owning its side effects (email, warehouse, analytics). Facts can't be rejected by handlers — a failing emailer retries or alerts.
Lesson 5
Subdomain [Khononov]
A coherent part of the business problem (problem space). Classified as core, supporting, or generic — which tells you where to invest attention.
Lesson 6
Core domain
The differentiating part of the business — why customers pick you. Build it yourself, best-in-class. Misclassifying it (or outsourcing it) is the expensive strategic error.
Lesson 6
Supporting subdomain
Necessary but non-differentiating (Meridian's catalog). Model deliberately simply.
Lesson 6
Generic subdomain
A solved problem everyone has (payments, tax). Buy, don't build; integrate behind an ACL.
Lesson 6
Bounded context [Evans]
The boundary within which one model and its ubiquitous language are valid (solution space). Same word, different contexts ⇒ different types. Here: one context = one folder; cross-context references are context-branded ids. Not a microservice.
Lesson 6
Context map [Evans]
The drawn set of contexts and their named relationships (shared kernel, customer–supplier, conformist, ACL, published language) — integration choices made deliberately.
Lesson 7
Anti-corruption layer (ACL) [Evans]
A boundary adapter translating a foreign system's model into yours, in exactly one place, so vendor vocabulary never leaks inward. Parse-don't-validate applied to a context boundary.
Lesson 7
Shared kernel
A deliberately tiny jointly-owned model slice shared by two contexts you control (Result, shared id brands). Grows carelessly ⇒ the contexts re-merge.
Lesson 7
Customer–supplier
Context relationship where an upstream you control plans around the downstream's needs.
Lesson 7
Conformist
Relationship where you adopt an upstream model as-is because translation isn't worth it. A valid choice when made consciously.
Lesson 7
Published language
A documented, versioned model published for many parties to integrate against.
Lesson 7
Functional core, imperative shell [Bernhardt]
The architecture line: pure, synchronous domain logic inside; all I/O — HTTP, DB, queues, clocks — in a thin shell that parses, loads, transitions, saves, dispatches, responds.
Lesson 8
Repository (functional)
A shell module of functions (loadOrder/saveOrder) plus pure translators (rowToOrder/orderToRow). The database is just another untrusted boundary — parse on load, serialize on save.
Lesson 8
← Lesson 1 Patterns cheat sheet →