Free 8-day email course
Modular Monolith
for .NET Developers
One deployable unit with boundaries between modules, and a real migration path to microservices when you need one. Built on a working .NET 10 solution, one lesson a day for 8 days. This course has a value of $500, but is free!
Already taking it by email? Create a free account to read every lesson here.
Free · No credit card · Unsubscribe anytime · Join 27,000+ developers already reading
- 8 lessons
- · one a day
- ~6-10 min each
- · Day 8 is the migration to microservices
- Real code in every lesson
- · from a working .NET 10 solution
Coming from a classic monolith or from microservices? Both paths lead here. A monolith gets the boundaries it never had: contracts between modules, one schema per module, and tests that keep your architecture from drifting. A microservices team gets the same rules without the network calls between modules. If you split your application too early into microservices, a Modular Monolith can be your better option.
Where you end up
By Day 8, you will build a Modular Monolith with boundaries and rules the build enforces, and you know exactly how to split the monolith when the day comes.
Before
- One big project where every feature can reach any table
- Or microservices from day one, and a distributed monolith six months later
- Cross-module JOINs that make extracting anything impossible
- Module boundaries that drift in the code as the project grows
- MediatR pipelines, repositories and services wrapping a DbContext that already does the job
After
- Four modules in one solution, each with its own PublicApi contract
- One PostgreSQL schema per module, no shared tables
- Handlers with Result<T> instead of exceptions, and no MediatR
- Events between modules, for asynchronous communication to decrease coupling
- Five ways to query across schemas and two ways to keep them consistent
- Architecture tests that fail the build when a module reaches too far
- A six-step plan to turn any module into a service when you really need it
What you build, in six layers
Each layer sits on the one before it. Every lesson walks through the same solution, so by Day 8 you have seen a Modular Monolith from the folder layout to the migration.
The foundation
Day 1
Four modules in one solution, each with its own Domain, Features and Infrastructure projects, talking only through PublicApi contracts.
Inside a module
Days 2–3
Vertical slices on top of Clean Architecture, handlers without MediatR, the Result pattern instead of exceptions, and events between modules.
The runtime
Day 4
.NET Aspire orchestrating PostgreSQL, Serilog with Seq, OpenTelemetry with Jaeger, and a Docker Compose file for the whole stack.
The data boundaries
Days 5–6
Five ways to query across schemas you cannot join, and two ways to keep them consistent: eventual with events, strong with a transaction manager.
The guardrails
Day 7
Architecture tests that fail the build the moment a module reaches past another module's PublicApi, plus naming and architecture rules.
The exit
Day 8
A six-step migration to microservices: service boundaries, extraction, HTTP and messaging between services, observability, and an API gateway.
The eight lessons
Here is every lesson, in the order it arrives.
Building a Modular Monolith in .NET: The Complete Project Structure Guide
Learn how to build a Modular Monolith in .NET with clear module boundaries, separate databases per module, and inter-module communication via public APIs. A complete guide with real-world project structure and code examples.
Vertical Slice Architecture with Clean Architecture in .NET: The Best Way to Structure Your Modules
Learn how to combine Vertical Slice Architecture with Clean Architecture in .NET to build well-structured modules inside a Modular Monolith. Explore the evolution from N-Layered to Clean to Vertical Slices with real-world code examples.
Implementing Handlers and Result Pattern in a Modular Monolith in .NET
Learn how to implement manual handlers, the Result pattern for error handling, and event-driven communication between modules in a .NET Modular Monolith. A complete guide with real-world code examples without MediatR.
Running a Modular Monolith With .NET Aspire: Orchestration, Logging, and Distributed Tracing
Learn how to run and orchestrate a Modular Monolith application using .NET Aspire 13. Configure PostgreSQL, Serilog, OpenTelemetry, and distributed tracing with Jaeger and Seq. A complete guide with real-world code examples.
What you actually end up writing
A solution layout that explains itself, and a test that fails the build the moment someone breaks the rules.
The solution — four modules, one host
Only the modules other modules call get a PublicApi project.
The architecture test — boundaries the build enforces
One wrong project reference and this fails, with the offending types listed.
src/
├─ Shipments/
│ ├─ Modules.Shipments.Domain/
│ ├─ Modules.Shipments.Features/
│ └─ Modules.Shipments.Infrastructure/
├─ Stocks/
│ ├─ Modules.Stocks.PublicApi/ ← the only way in
│ ├─ Modules.Stocks.Domain/
│ ├─ Modules.Stocks.Features/
│ └─ Modules.Stocks.Infrastructure/
├─ Carriers/ (same shape, with PublicApi)
├─ Users/ (same shape, no PublicApi)
├─ Common/ Result<T>, events, endpoints
└─ ModularMonolith.Host/ Program.cs[Fact]
public void StocksModule_ShouldNotHaveDependencyOn_AnyOtherModule()
{
var result = Types.InAssemblies(GetStocksModuleAssemblies())
.Should()
.NotHaveDependencyOnAny(
UsersNamespace,
CarriersNamespace,
ShipmentsNamespace)
.GetResult();
Assert.True(result.IsSuccessful,
string.Join(", ", result.FailingTypeNames ?? []));
}What you need before Day 1
ASP.NET Core and EF Core basics
You have built an API with Minimal APIs or controllers and queried a database with EF Core. The course builds on that, it does not teach it.
.NET 10 SDK, Docker installed
To run your application you need to have .NET 10 SDK and Docker installed on your machine.
A domain you can slice
A real application with at least two areas that could own their data separately. Reading with your own system in mind is where the lessons turn into decisions.
This is not for you if
- You want a microservices-first tutorial with Kubernetes on Day 1
- You have never built an ASP.NET Core API with EF Core
- You expect a framework or a library to decide the architecture for you
Frequently Asked Questions
The course
What you need
Fit
Still have a question? Email me at [email protected].
Day 1 lands in your inbox in a few minutes
Eight lessons. One working solution. Free, and yours to keep.
Already taking it by email? Create a free account to read every lesson here.
Free · No credit card · Unsubscribe anytime
By Anton Martyniuk · Microsoft MVP · 13+ years in production .NET
