Vertical Slice Architecture (VSA) is a software design approach that organizes code by business features rather than technical layers. In a traditional layered architecture, implementing a "Create Order" feature means working across Controllers/, Services/, Repositories/, Domain/, and DTOs/ — often spread across 5+ separate projects. VSA flips this on its head: everything for "Create Order" lives in one folder, one file, or at most a small cluster of files within a single project.
Why VSA Matters in .NET 10
.NET 10's Minimal APIs make VSA more natural than ever. You can define an entire feature — endpoint, request/response DTOs, validation, and handler logic — in a single C# file using top-level statements and MediatR. The result is maximum cohesion: everything you need to understand a feature is in one place. No more jumping between 7 projects in Solution Explorer just to trace a single user action.
Key Benefits
- Maximum Cohesion: All code for a feature lives together. When you need to modify "Create Order," you open one file.
- Faster Onboarding: New developers understand a feature by reading a single file, not tracing through 5 projects.
- Reduced Merge Conflicts: Teams working on different features rarely touch the same files.
- Easier Testing: Each slice is self-contained and can be tested in isolation.
A Concrete Example
// Features/Orders/CreateOrder.cs
public static class CreateOrderEndpoint
{
public static void Map(IEndpointRouteBuilder app) =>
app.MapPost("/api/orders", async (CreateOrderCommand cmd, IMediator m) =>
Results.Ok(await m.Send(cmd)));
}
public record CreateOrderCommand(string CustomerId, List Items) : IRequest;
public class CreateOrderHandler : IRequestHandler
{
readonly AppDbContext _db;
public CreateOrderHandler(AppDbContext db) => _db = db;
public async Task Handle(CreateOrderCommand cmd, CancellationToken ct)
{
var order = Order.Create(cmd.CustomerId, cmd.Items);
_db.Orders.Add(order);
await _db.SaveChangesAsync(ct);
return OrderDto.FromEntity(order);
}
}
That's it. One file contains the API endpoint, the command, the handler, and the result DTO. When you need to modify how orders are created, you open this file. When a new developer joins, they read this file and understand the entire flow. This is the power of VSA.
Key Takeaways
- VSA organizes by business capability, not technical concern
- .NET 10 Minimal APIs + MediatR make VSA natural and concise
- Every Indotalent product uses this architecture — study real production code
- One file = one feature = zero confusion