Blog
Mert Özen's blog posts on software development, backend, frontend, and DevOps.
When to Use Vertical Slices: Combining Them with Clean Architecture and Modular Monoliths
Vertical slices work well for APIs that gain features often and whose use cases vary in complexity; they aren't enough on their own for teams without refactoring discipline or for rich, shared domains, and they work best together with a Clean domain core and modular monolith boundaries. We split Bookstore into modules and protect the boundary with internal and ArchUnitNET, evaluate REPR with FastEndpoints, and lay out a plan for moving a layered project to slices gradually.
Testing Vertical Slices: Integration Tests per Slice and Unit Tests Where They Matter
A slice's natural test unit is the path from the HTTP request to the real database, while domain rules are tested cheaply with pure unit tests. We build per-slice tests with WebApplicationFactory, a real SQL Server via Testcontainers, and Respawn, and show with real output how tests break each other without a reset and how the InMemory provider both passes and fails wrongly on the same search query.
Sharing Across Slices: Duplication or Abstraction, and Where Does Domain Logic Go?
Across slices you share the domain model, cross-cutting concerns, and infrastructure; you don't share request/response types, queries, or workflows, and invariants move into the entity without waiting for a second copy. With real output we see a rule placed on a request allow a 7-copy order and a slice calling another slice save an order whose payment was declined, then prevent that with an ArchUnitNET slice test.
Slices with a Mediator: Comparing MediatR, Source-Generated Mediator, and Wolverine
The real gain of a mediator in slices is a pipeline that is independent of the entry point; as of November 2026 MediatR 14.3 is RPL 1.5 or commercially licensed, while Mediator 3.0.2 and Wolverine 6.62 are MIT. We write the same PlaceOrder slice with all three tools and with a mediator-free endpoint filter, and compare dispatch cost, first-request time, Native AOT behaviour, and each tool's real setup pitfalls.
Your First Slice Without MediatR: Minimal API, a Handler Class, and Endpoint Registration
A slice without MediatR is built from request and response records, a handler class that uses DbContext directly, and an IEndpoint that maps its own route, with an assembly scan doing the registration. We write Bookstore's PlaceOrder and GetOrderDetails slices with .NET 10 AddValidation, TypedResults, and EF Core projections, and show how a naming convention can take down every endpoint and how to catch that at startup.
What Is Vertical Slice Architecture? Organizing Code by Feature, Not by Layer
Vertical Slice Architecture slices code by what each request needs end to end rather than by technical layer, so coupling drops between slices and rises inside them. With real git output we watch the same two features conflict in five files in a layered Bookstore and in one file in a sliced one, then look at a slice's anatomy and three common misreadings.
When Is Clean Architecture Too Much? Template Cargo Cults, Interface Explosion, and a Pragmatic Path
Clean Architecture is too much for CRUD-heavy, short-lived or single-adapter small services with no business rules to protect, and pays off in long-lived regions with rules and several adapters. The symptoms of template cargo cults and interface explosion, protecting the same Dependency Rule with a single project and ArchUnitNET tests, and migrating a layered project gradually with FreezingArchRule.