Vertical.Slice.Architecture 1.4.0

dotnet new install Vertical.Slice.Architecture@1.4.0
                    
This package contains a .NET Template Package you can call from the shell/command line.

ASP.NET Core Vertical Slice Architecture Template

This template provides a lightweight starting point for ASP.NET solutions. While inspired by Jason Taylor's Clean Architecture, this project focuses strictly on Vertical Slice Architecture.

Install the template

dotnet new install Vertical.Slice.Architecture

Create a new solution

dotnet new vsa-sln -n [SolutionName]

Key Features

  • Target Framework: .NET SDK 10.0.202.
  • No MediatR dependency: Uses lightweight reflection at application startup to automatically discover and register IRequestHandler & IDomainEventHandler
  • Native Pipeline Filters: Because MediatR was removed, MediatR PipelineBehaviors have been replaced with native IEndpointFilter implementations.
  • Persistence: Configured with SQLite db out of the box (recent vulnerability issues with SQLitePCLRaw.lib.e_sqlite3 are suppressed in Directory.Build.Props).
  • App Host & SPA (WIP): Uses .NET App Host to orchestrate the backend and a React SPA. Note: The React client integration is currently a work in progress.

Technologies

IEndpointFilter implementations

  1. LoggingFilter:
    • logs incoming requests in the following format:
    • "Request: {HttpMethod} {Path}, {@UserId}, {@Request}, {@ResponseStatusCode}"
  2. ValidationFilter:
    • this filter automatically intercepts Minimal API requests, looking for a parameter that implements IRequest. If found, it resolves and executes the corresponding IValidator implementations.
    • Important: For automatic validation to occur, your endpoint method must explicitly include an IRequest parameter. Otherwise, validation is skipped and must be handled manually within the endpoint.
    • For HTTP GET/ DELETE: use [AsParameters] on the IRequest object
  3. PerformanceFilter:
    • logs requests that run for more than 500ms.

Structure

Code is grouped by feature rather than technical layer. Everything required to execute a specific feature lives in a single folder inside the Features directory.

ClientApp/ # React app
Common/
└──Pipeline/  # Native endpoint filters replacing MediatR behaviors
    ├── ExceptionHandler.cs
    ├── LoggingFilter.cs
    ├── PerformanceFilter.cs
    └── ValidationFilter.cs
    
Features/
└── Examples/
    ├── Commands/  # Commands, handlers and validators
    ├── Events/    # Domain events
    ├── Queries/   # Queries, handlers and validators
    ├── Example.cs # Entity
    ├── ExampleConfiguration.cs  # EF Core Entity Configuration
    ├── ExampleDto.cs            # DTO
    └── ExampleEndpoints.cs      # Minimal API Endpoints

Infrastructure/ # Services with external dependencies
    Database/

Testing

This solution uses NUnit as its primary testing framework. Testing is currently focused on the FunctionalTests project, which validates application logic by integrating with a real database spun up via Aspire and hosted in memory using WebApplicationFactory.

Application Logic Validation

To test application IRequest and IDomainEvent implementations and their handlers you can use the ApplicationTestBase class which ensures that:

  • The database is reset to a clean state before every test.
  • A fresh Dependency Injection IServiceScope is created.
  • The domain event spy is cleared.

EF Core Entity Configuration Validation

  • To test EF Core entity configuration without needing a database connection, inherit from EntityConfigurationTestBase<TConfiguration, TEntity>. The class provides helper methods to gain access to the required objects for validation.

This package has no dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.4.0 101 7/9/2026
1.3.0 145 6/24/2026
1.2.1 136 6/19/2026
1.2.0 134 6/19/2026
1.1.1 135 6/18/2026
1.1.0 148 6/18/2026
1.0.1 136 6/17/2026
1.0.0 244 6/17/2026