Standalone conceptConceptChapter I · Domain · Building block 17 of 18

Shared Kernel

The shared part stays small, visibly versioned and protected by tests and direct team coordination.

  1. KernelSmall shared model fragment.
  2. ResponsibilityTeams coordinate changes.
  3. 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.

Shop example · Mapping

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

  1. Kernel Scope
  2. Responsibility Collaboration
  3. Tests Compatibility
Shared Kernel and separate models
CriterionShared KernelSeparate models
MeaningExactly sharedTranslated per context
ChangeCoordinate jointlyEvolve independently
CouplingHigherLower
The choice weighs shared semantics against coordination effort.

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

  1. 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.
  2. Limit the kernel to necessary types and rules, version changes transparently, and establish shared tests. Agree which teams approve changes and verify compatible releases.
  3. 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

  1. 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.

  2. 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.

  3. 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.

Continue on the learning path

Next in Domain Modelling & DDD: Anti-Corruption Layer.