Designing Module Boundaries with Domain-Driven Design
Find good module boundaries for a modular monolith using DDD: bounded contexts, ubiquitous language, event storming, context maps and signs a boundary is wro...
Published November 27, 2026
The success of a modular monolith depends almost entirely on where the module boundaries are drawn. Draw them well and modules evolve independently with little coordination. Draw them badly and every feature touches four modules, which is worse than having no modules at all. Domain-Driven Design (DDD) offers the most reliable tools for finding good boundaries: bounded contexts, ubiquitous language and event storming.
The concept
A bounded context is a part of the business where a particular model and vocabulary apply consistently. The word "product" means something different to catalogue (descriptions, images, categories), pricing (base price, discounts, tax class), inventory (stock levels per warehouse) and shipping (weight, dimensions). Trying to build one Product class that serves all of them creates a giant, coupled model. Giving each context its own model, linked by IDs, creates natural module boundaries.
Good boundaries maximise cohesion inside a module and minimise coupling between modules. Signals that you have found a boundary include a change in vocabulary, a different team or business stakeholder, different rates of change, and different consistency needs. Signals that a boundary is wrong include constant cross-module changes, chatty calls back and forth, and shared tables that both sides write to.
One concept, several models
Finding boundaries with event storming
- Run an event-storming workshop: list domain events on a timeline ("Order Placed", "Payment Captured")
- Group events by the people and language around them
- Draw candidate boundaries where language or ownership changes
- Identify commands, aggregates and the data each group needs
- Map relationships between contexts (upstream/downstream, shared IDs, events)
- Validate by walking through real feature requests
Is this a good boundary?
| Signal | Suggests |
|---|---|
| Vocabulary changes ("lead" vs "customer" vs "account") | Different bounded contexts |
| Different business owner or team | Separate module |
| Different change rate (pricing rules weekly, catalogue rarely) | Separate module |
| Features constantly touch both A and B | Boundary may be in the wrong place |
| A and B both write the same table | Unclear ownership; fix before splitting further |
| Many tiny modules calling each other constantly | Boundaries too fine-grained |
Context maps
A context map shows how modules relate. Common relationships include customer/supplier (one module depends on another's published API), conformist (the downstream accepts the upstream model as is), and anti-corruption layer (the downstream translates the upstream model into its own to avoid contamination, essential when integrating legacy systems or third-party APIs). Drawing the map makes dependencies explicit and highlights modules that too many others depend on.
Practical examples
Different models linked by ID
Each module keeps only the fields it needs.
// catalog module
type CatalogProduct = { productId: string; title: string; images: string[]; categoryId: string }
// pricing module
type PricedItem = { productId: string; basePricePaise: number; taxClass: 'GST5' | 'GST18' }
// inventory module
type StockLevel = { productId: string; warehouseId: string; available: number }Anti-corruption layer for a legacy system
Translate the external model at the edge of the module.
class LegacyErpCustomerTranslator {
toAccount(erp: ErpCustomerRecord): Account {
return new Account(
AccountId.of(erp.CUST_NO.trim()),
erp.NAME1 + (erp.NAME2 ? ' ' + erp.NAME2 : ''),
erp.STATUS === 'A' ? 'active' : 'suspended',
)
}
}Event-storming output (excerpt)
Events grouped into candidate modules.
Catalogue: ProductCreated · ProductPublished · CategoryChanged
Checkout: CartCreated · ItemAdded · OrderPlaced
Billing: InvoiceIssued · PaymentCaptured · RefundIssued
Fulfilment: ShipmentCreated · ParcelDispatched · DeliveryConfirmedCommon mistakes
- Splitting by technical layer (controllers, services, repositories) instead of business capability.
- One shared "god" entity (User, Product) used by every module.
- Too many tiny modules, recreating microservice chattiness in-process.
- Drawing boundaries in a meeting without domain experts.
- Never revisiting boundaries as understanding of the domain improves.
Key takeaways
- Bounded contexts from DDD are the best guide to module boundaries.
- Changes in vocabulary, ownership and change rate signal boundaries.
- Give each module its own model; link modules by IDs.
- Use event storming to discover boundaries and context maps to document relationships.
FAQ
How big should a module be?
Big enough to be cohesive and owned by one team, small enough for that team to understand fully. Most products start with 4-10 modules.
Is DDD required for a modular monolith?
No, but its strategic tools (bounded contexts, ubiquitous language, context maps) are the most effective way to find boundaries. Tactical patterns such as aggregates are optional.
What if I get the boundaries wrong?
Inside a monolith, moving a boundary is a refactor, not a cross-service migration. That flexibility is a major reason to start modular rather than with microservices.