SSW.VerticalSliceArchitecture.Template 2025.6.4

Prefix Reserved
dotnet new install SSW.VerticalSliceArchitecture.Template::2025.6.4
                    
This package contains a .NET Template Package you can call from the shell/command line.

SSW Banner

SSW Vertical Slice Architecture Template

<div align="center">

SSW TV | YouTube

Package contributions welcome

</div>

๐Ÿค” What is it?

An enterprise ready solution template for Vertical Slice Architecture. This template is just one way to apply the Vertical Slice Architecture.

Read more on SSW Rules to Better Vertical Slice Architecture

โœจ Features

  • ๐Ÿ”จ dotnet new cli template - to get you started quickly

  • ๐Ÿš€ Aspire

    • Dashboard
    • Resource orchestration
    • Observability
    • Simple dev setup - automatic provisioning of database server, schema, and data
  • ๐ŸŽฏ Domain Driven Design Patterns

    • AggregateRoot
    • Entity
    • ValueObject
    • DomainEvent
  • ๐ŸŒ Minimal Endpoints - because it's fast & simple. โšก

    • Extension methods to ensure consistent HTTP Verbs & Status Codes
  • ๐Ÿ“ OpenAPI/Scalar - easily document your API

  • ๐Ÿ”‘ Global Exception Handling - it's important to handle exceptions in a consistent way & protect sensitive information

    • Transforms exceptions into a consistent format following the RFC7231 memo
  • ๐Ÿ—„๏ธ Entity Framework Core - for data access

  • ๐Ÿงฉ Specification Pattern - abstract EF Core away from your business logic

  • ๐Ÿ”€ CQRS - for separation of concerns

  • ๐Ÿ“ฆ MediatR - for decoupling your application

  • ๐Ÿ“ฆ ErrorOr - fluent result pattern (instead of exceptions)

  • ๐Ÿ“ฆ FluentValidation - for validating requests

  • ๐Ÿ†” Strongly Typed IDs - to combat primitive obsession

    • e.g. pass CustomerId type into methods instead of int, or Guid
    • Entity Framework can automatically convert the int, Guid, nvarchar(..) to strongly typed ID.
  • ๐Ÿ“ Directory.Build.Props

    • Consistent build configuration across all projects in the solution
      • e.g. Treating Warnings as Errors for Release builds
    • Custom per project
      • e.g. for all test projects we can ensure that the exact same versions of common packages are referenced
      • e.g. XUnit and NSubstitute packages for all test projects
  • โš–๏ธ EditorConfig - comes with the SSW.EditorConfig

  • ๐Ÿงช Testing

  • Architecture Tests

    • Using NetArchTest
    • Know that the team is following the same Vertical Slice Architecture fundamentals
    • The tests are automated so discovering the defects is fast

๐ŸŽ‰ Getting Started

Prerequisites

Installing the Template

  1. Install the SSW CA template
dotnet new install SSW.VerticalSliceArchitecture.Template

NOTE: The template only needs to be installed once. Running this command again will update your version of the template.

  1. Create a new directory
mkdir Sprout
cd Sprout
  1. Create a new solution
dotnet new ssw-vsa

NOTE: name is optional; if you don't specify it, the directory name will be used as the solution name and project namespaces.

Alternatively, you can specify the name and output directory as follows:

dotnet new ssw-vsa --name {{SolutionName}} --output .\

Adding a Feature Slice

To speed up development there is a dotnet new template to create a full Vertical Slice:

  • Creates a domain object in Common/Domain/*
  • Adds domain configuration in Common/Persistence/*
  • Creates Command & Query API endpoints in Features/*
  1. Add a new Feature
cd src/WebApi/

dotnet new ssw-vsa-slice --feature Person --feature-plural People

--feature or -f where the value is the singular name of the feature. --feature-plural or -fp where the value is the plural name of the feature.

  1. Configure this Feature

This project uses strongly typed IDs, which require registration in the VogenEfCoreConverters class:

// Register the newly created Entity ID here
[EfCoreConverter<PersonId>]
internal sealed partial class VogenEfCoreConverters;

Running the Solution

  1. Change directory

    Windows:

    cd tools\AppHost\
    

    Mac/Linux:

    cd tools/AppHost/
    
  2. Run the solution

    dotnet run
    

NOTE: The first time you run the solution, it may take a while to download the docker images, create the DB, and seed the data.

  1. Open https://localhost:7255/scalar/v1 in your browser to see it running ๏ธ๐Ÿƒโ€โ™‚๏ธ

๐ŸŽ“ Learn More

alternate text is missing from this package README image alternate text is missing from this package README image

Vertical Slice Architecture: How Does it Compare to Clean Architecture | .NET Conf 2023

graph TD;
    subgraph ASP.NET Core Web App
        subgraph Slices
            A[Feature A]
            B[Feature B]
        end
        Slices --> |depends on| Common
        Host --> |depends on| Common
        Host --> |depends on| Slices
        ASPNETCore[ASP.NET Core] --> |uses| Host
    end

    Common[Common]

๐Ÿš€ Publishing Template

Template will be published to NuGet.org when changes are made to VerticalSliceArchitecture.nuspec on the main branch.

Process

  1. Update the version attribute in VerticalSliceArchitecture.nuspec
  2. Merge your PR
  3. package GitHub Action will run and publish the new version to NuGet.org
  4. Create a GitHub release to document the changes

NOTE: We are now using CalVer for versioning. The version number should be in the format YYYY.M.D (e.g. 2024.2.12).

๐Ÿค Contributing

Contributions, issues and feature requests are welcome! See Contributing for more information.

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
2025.6.4 201 6/4/2025
0.9.2 161 5/27/2025
0.9.0 807 5/14/2024
0.8.0 113 5/14/2024

Updates release workflow