Curated Bundles of the Corpus
The corpus is large; a new project does not adopt it all at once. @frenchexdev/ddd-preset is the package that bundles a curated, named, versioned slice. DDD_PRESET_V0_1 is the v0.1 reference: eight tactical Requirements, six application Requirements, twelve generator stages in deterministic order. The project that adopts it opts into a coherent slice and ignores the rest until needed.
What Preset Reifies
The pattern is coordinated opt-in. A new package's package.json depends on @frenchexdev/ddd-preset, the build pipeline reads the preset's metadata, the codegen plugin runs the stages in order, the compliance gate checks the listed Requirements. One dependency, one slice, one coherent behaviour.
The preset is versioned for the same reason any contract is versioned. v0.1 ships the M2 tactical surface. A future v0.2 will add strategic generators (subdomain, bounded-context, context-relationship). A project pinned to v0.1 does not see the new generators until it bumps; a project that adopts v0.2 deliberately opts into the wider surface.
The Runtime: ddd-preset
preset.ts declares the metadata shape and the v0.1 reference instance. The tacticalRequirements list names the eight DDD-tactical Requirement ids (REQ-ENTITY-IDENTITY, REQ-VALUE-OBJECT-IMMUTABILITY, REQ-AGGREGATE-CONSISTENCY-BOUNDARY, etc.). The applicationRequirements list names the six application-layer ones (mediator, event-bus, pipeline-behavior, configuration-as-code, module composition, meta-modulation).
The generatorStages array is the deterministic ordering for codegen. Each entry is { id, stage } where stage is a two-digit string like '00', '05', '72'. The numbers are spaced — a new generator inserted at '27' between '25' (factory) and '30' (domain-service) does not require renumbering everything else. generatorOrder(preset) returns the ids in stage-ascending order.
import { DDD_PRESET_V0_1, generatorOrder } from '@frenchexdev/ddd-preset';
const order = generatorOrder(DDD_PRESET_V0_1);
// ['ddd-entity-codegen', 'ddd-value-object-codegen', 'ddd-aggregate-root-codegen', ...]
// The codegen plugin runs the generators in this order.import { DDD_PRESET_V0_1, generatorOrder } from '@frenchexdev/ddd-preset';
const order = generatorOrder(DDD_PRESET_V0_1);
// ['ddd-entity-codegen', 'ddd-value-object-codegen', 'ddd-aggregate-root-codegen', ...]
// The codegen plugin runs the generators in this order.The pattern is small but load-bearing — the codegen plugin's codegen:build reads this order, and the determinism is what makes the build idempotent across machines and CI runs.
The Analyzer: ddd-preset-analyzer
Spec-first sibling. The analyzer verifies that every preset's generatorStages entry resolves to a real codegen package in the workspace, that every Requirement id is registered in ddd-spec, and that the version is monotonically increasing across releases. The preset is a contract; the analyzer is the contract's enforcement.
There is no ddd-preset-codegen — the preset is its own output, no further generation needed.
Cross-Links
- Consumed by the Codegen plugin —
generatorOrder()returns the schedule the plugin runs. - Refers to Requirement ids registered in the Spec kernel.
- Surfaces the same data the Compliance plugin consumes for the traceability matrix.
Back to the series index.