Shared Kernel
The shared part stays small, visibly versioned and protected by tests and direct team coordination.
- KernelSmall shared model fragment.
- ResponsibilityTeams coordinate changes.
- TestsProtect the shared contract.
Context
Why this is important
Keep a jointly owned model fragment small and coordinate its change explicitly.
Strategic DDD and collaboration around business models.
Shared Kernel and separate models
The shop remains a modular monolith with seven business modules and a shared deployment.
This is how you read the picture
- Kernel Scope
- Responsibility Collaboration
- Tests Compatibility
| Criterion | Shared Kernel | Separate models |
|---|---|---|
| Meaning | Exactly shared | Translated per context |
| Change | Coordinate jointly | Evolve independently |
| Coupling | Higher | Lower |
Benefits & limitations
Helps if:
- A small business concept must be shared exactly for a clear reason.
- The teams involved can plan, test and release changes together.
Boundaries
- A shared codebase couples model and release decisions.
- As the shared part grows, separate models with explicit translation are often clearer.
In practice
- Name the shared domain fragment and check whether both contexts truly need the same meaning. Record that shared meaning and its maintenance ownership in an agreement for both teams.
- Limit the kernel to necessary types and rules, version changes transparently, and establish shared tests. Agree which teams approve changes and verify compatible releases.
- For each extension, assess whether shared semantics still provide more value than the coordination effort. Remove elements shared only for convenience or given a different meaning in one context.
Read the detailed explanation
A Shared Kernel is a deliberate exception to otherwise separate models. Teams define which types or rules belong in it and how changes are reviewed together. Sharing reduces translation effort but couples release and model decisions. A large shared library can become a hidden integration contract when ownership and change cadence diverge.
Shared Kernel is a Context Map relationship. A Context Map frames collaboration; each Bounded Context defines its model boundary.
Check your understanding
Test yourself in three stages
ReadingCheck in the picture
What do the shop modules share in the example?
View the solution with justification
A confirmed order reference with a coordinated contract.
ApplyingTransferred to a new situation
What belongs in a Shared Kernel?
View the solution with justification
Only a deliberately shared and maintained model fragment with identical business meaning.
EvaluateWeighing an alternative
When is separating the models worthwhile?
View the solution with justification
When shared changes cost more coordination than the shared semantics provide value.
Explore further
These building blocks continue the thoughts of this page.
References
- Eric Evans · DDD Reference (opens in new tab)Primary reference on Context Mapping and shared model kernels.
- Vaughn Vernon · Implementing Domain-Driven Design (opens in new tab)Practical examples of context relationships and shared model maintenance.
- Domain-Driven Design Reference · Context Mapping (opens in new tab)Terminology reference for relationships between Bounded Contexts.