New template.NET 10 · Free

Ship features, not layers

A production-ready Vertical Slice Architecture template for .NET. One project, one file per feature, and every cross-cutting concern already wired: lightweight CQRS, JWT with refresh tokens, caching, telemetry, and tests.

Secure Delivery
Instant Access
No Credit Card
Template user
Template user
Template user
Template user
Template user

45,000+ developers use my templates

One use case: create a todo
Layered6 files · 4 projects

Web.Api

CreateTodo.cs

Application

Command.csHandler.csValidator.cs

Infrastructure

TodoConfig.cs

Domain

TodoItem.cs
Vertical slice1 file · 1 project

Features/Todos/CreateTodo.cs

CommandValidatorHandlerEndpoint

// ~120 lines. One review, one delete.

Same behavior, same tests. One version is spread across four projects, the other is a file you can open, review, and delete in one go.

1

Project to run

1

File per feature

.NET 10

Framework

Free

Forever

Anatomy of one file

Every use case is a single static class with four nested parts. Nothing is hidden in a folder three projects away.

Features/Todos/CreateTodo.cs
public static class CreateTodo
{
// the input
public sealed class Command : ICommand<Guid>
{
public string Description { get; set; }
public Priority Priority { get; set; }
}
 
// the rules
public sealed class Validator : AbstractValidator<Command>
{
RuleFor(c => c.Description).NotEmpty().MaximumLength(255);
}
 
// the logic
internal sealed class Handler(ApplicationDbContext context)
: ICommandHandler<Command, Guid>
{
public async Task<Result<Guid>> Handle(...)
}
 
// the route
public sealed class Endpoint : IEndpoint
{
app.MapPost("todos", ...).RequireAuthorization();
}
}

Deleting the feature means deleting the file. No orphaned interfaces, no dead DTOs stranded in a shared project, no grep across four folders to find what a change touches.

1

File to open

0

Projects to cross

~120

Lines, end to end

Want that file in your editor?

The whole template is free. Drop your email and it is in your inbox in a minute.

Get the template

The journey of a request

Five stops between the socket and the database, and every one of them is a file you can open and change.

01

Arrive

A Minimal API endpoint, discovered at startup. Rate limited and authenticated first.

02

Validate

The validation decorator runs FluentValidation rules and short-circuits on failure.

03

Handle

Your use case. DbContext injected directly, no repository sitting in between.

04

Persist

EF Core against PostgreSQL, with domain events dispatched after the save.

05

Respond

The Result maps to 200 or to a ProblemDetails payload. Never an exception.

Rate limiting, authentication, validation, logging, caching, and ProblemDetails responses. Configured, not just referenced.

Batteries included, opinions where it matters

The boring parts of a new .NET API, decided and implemented, so day one is spent on your domain.

CQRS you own

Lightweight ICommand and IQuery abstractions, registered by Scrutor assembly scanning. A few dozen lines you can read, with no third-party dispatcher in the middle.

Auth that survives production

JWT authentication with refresh tokens and rotation, plus permission-based authorization policies you can extend per endpoint.

EF Core and PostgreSQL

Snake_case naming, migrations, entity configurations, and a domain events dispatcher. DbContext goes straight into handlers, with no repository ceremony.

HybridCache built in

Fast, unified caching with the cache keys and invalidation already modeled, sitting right next to the use cases that own them.

OpenTelemetry and Seq

Tracing and metrics for ASP.NET Core, HTTP, Npgsql, and the runtime. Serilog structured logs land in Seq on localhost:8081.

Tests you can actually run

Unit tests plus integration tests on Testcontainers, hitting a real PostgreSQL container over real HTTP. One dotnet test away.

A folder you can read in a minute

No Domain, Application, Infrastructure, and Web projects passing types back and forth. One Web.Api project, features on the left, shared plumbing on the right.

  • Each use case is one file under Features/{Entity}/
  • Shared primitives (Result, Error, IEndpoint) live in Common/
  • Persistence, migrations, and the domain event dispatcher in Database/
  • Unit tests and Testcontainers integration tests in tests/

Outgrown a slice? Promote it. Nothing in the template stops you from extracting a module or a service later, and the file boundary shows you exactly what moves.

vertical-slice/
src/Web.Api/
├─ Features/
│ ├─ Todos/
│ │ ├─ CreateTodo.cs # command + handler + endpoint
│ │ ├─ CompleteTodo.cs
│ │ ├─ GetTodos.cs
│ │ ├─ TodoItem.cs
│ │ └─ TodoItemErrors.cs
│ └─ Users/ # register, login, refresh
├─ Common/ # Result, Error, decorators
├─ Database/ # EF Core, migrations, events
├─ Authentication/ # JWT + refresh tokens
├─ Authorization/ # permissions
└─ Program.cs
 
tests/
├─ Web.Api.UnitTests/
└─ IntegrationTests/ # Testcontainers

One project, .NET 10, free forever. Have it running before your coffee gets cold.

Get the template

Running in two minutes

1

Drop your email

The template lands in your inbox as a ready-to-run solution. No sign-up wall, no upsell required.

2

docker compose up

PostgreSQL and Seq start together. Then dotnet run --project src/Web.Api and the API is live.

3

Copy a slice

Open Features/Todos/CreateTodo.cs, copy it, rename it. That is what adding a feature looks like.

Questions people ask

Is Vertical Slice Architecture better than Clean Architecture?

Neither is better. Vertical slices trade layer enforcement for speed and locality, which is a great fit for small teams and services with a clear scope. Clean Architecture pays off when you have many developers and long-lived domain rules to protect. This template gives you the vertical slice option, fully built out.

Which .NET version does the template target?

It targets .NET 10 by default. Directory.Build.props has notes for retargeting to .NET 8 or .NET 9 if you are not on the latest runtime yet.

How does the CQRS dispatching work?

The template ships its own ICommand, IQuery, ICommandHandler, and IQueryHandler abstractions, registered by Scrutor assembly scanning. Handlers are injected directly, and cross-cutting concerns like logging and validation are plain decorators you can read in a minute.

Is it really free?

Yes. The template is free forever, and so are the updates. You get an email when a new version ships.

Your next feature is one file away

The full Vertical Slice Architecture template, free, in your inbox. Clone it, run it, and start shipping.

Secure Delivery
Instant Access
No Credit Card

No credit card. Targets .NET 10, works on .NET 8 and 9.