Draw module boundaries wrong and you fight your own architecture on every feature. Bounded contexts give you a systematic way to draw them: map business capabilities, give each module its own language and data, and validate with the change test. Plus three common boundary mistakes.
- ddd
- modular-monolith
- software-architecture
The Ordering module publishes an event, and Shipping and Notifications react without the publisher knowing they exist. The catch: an in-process event bus runs every handler synchronously in the caller's scope, so a slow or failing consumer becomes the publisher's problem. Here is the full setup, and the point where the outbox pattern has to take over.
- distributed-systems
- dotnet
- modular-monolith
Build a working Modular Monolith skeleton in .NET: three modules, each with its own schema and DbContext, cross-module calls that go through Contracts projects only, and an in-process event bus. Architecture tests fail the build the moment someone crosses a boundary.
- dotnet
- modular-monolith
- software-architecture
Placing an order touches Ordering, Inventory, Payment, and Shipping, and any step can fail after the previous ones already committed. The saga pattern breaks the process into local transactions with compensating actions, coordinated by an orchestrator that fits in one class. Here is how to build one inside a modular monolith, without a distributed transaction.
- distributed-systems
- dotnet
- modular-monolith
Schema-per-module and database-per-module both enforce module boundaries at the data layer, but they differ sharply on transactions, operations, and your path to microservices. Here is the EF Core setup for both, the five trade-offs that matter, and the triggers that tell you when to graduate from schemas to separate databases.
- dotnet
- ef-core
- modular-monolith
Modules need to share some code without becoming coupled. The shared kernel pattern defines a small, explicit set of shared types that all modules can depend on.
- ddd
- dotnet
- modular-monolith
Big-bang rewrites fail for predictable reasons: they take longer than planned, the legacy system keeps changing underneath them, and the business sees nothing until the end. The Strangler Fig pattern replaces a legacy monolith one bounded context at a time, with feature-flag routing, data sync, and a parallel run before every cutover. The system stays fully functional throughout.
- dotnet
- modular-monolith
- software-architecture
Extract a module too early and you lock unstable boundaries into network contracts. Wait too long and extraction becomes a multi-month rewrite. These are the four concrete drivers that justify extracting a module into a microservice, the readiness checklist to pass first, and the extraction process that keeps a rollback path open.
- dotnet
- microservices
- modular-monolith
The dual-write problem leaves your database and message broker inconsistent when one write succeeds and the other fails. The Outbox pattern eliminates it by turning two unreliable writes into one atomic operation.
- distributed-systems
- dotnet
- ef-core
A modular monolith keeps one deployment while enforcing business boundaries inside the codebase. This guide connects module design, data isolation, communication, testing, and the evidence that can justify extracting a service later.
- dotnet
- modular-monolith
- software-architecture
Modular Monoliths give you most of the benefits of microservices (loose coupling, independent modules, clear boundaries) without the operational complexity. Here is a practical comparison to help you decide which fits your project.
- dotnet
- microservices
- modular-monolith