SSW.CleanArchitecture.Template 0.5.0

The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org. Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet new install SSW.CleanArchitecture.Template::0.5.0
This package contains a .NET Template Package you can call from the shell/command line.

SSW Banner

SSW Clean Architecture Template

<div align="center">

SSW TV | YouTube

.NET Code Scanning Package contributions welcome ADRs

</div>

๐Ÿค” What is it?

This is a template for creating a new project using Clean Architecture, leveraging SSW Rules & SSW's over 30 years of experience developing software in the Microsoft space.

โœจ Features

  • โš–๏ธ EditorConfig - comes with the SSW.EditorConfig
  • ๐Ÿ“ฆ Slim - no authentication provider, no authorization & no UI framework
  • ๐ŸŒ Minimal Endpoints - because it's fast & simple. โšก
    • Extension methods to ensure consistent HTTP Verbs & Status Codes
  • ๐Ÿ”‘ 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
  • ๐Ÿ“ OpenAPI/Swagger - easily document your API
  • ๐Ÿ—„๏ธ 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
  • ๐Ÿ“ฆ FluentValidation - for validating requests
  • ๐Ÿ“ฆ AutoMapper - for mapping between objects
  • ๐Ÿ†” 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.
  • ๐Ÿ”จ dotnet new cli template - to get you started quickly
  • ๐Ÿ“ 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
  • ๐Ÿงช Testing
    • as per ssw.com.au/rules/rules-to-better-testing/

    • Simpler Unit Tests for Application

    • Better Integration Tests

      • Using Respawn and TestContainers
      • Integration Tests at Unit Test speed
      • Test Commands and Queries against a Real database
      • No Entity Framework mocking required
      • No need for In-memory database provider
    • Architecture Tests

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

๐Ÿš€ Publishing Template

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

Process

  1. Update the version attribute in CleanArchitecture.nuspec
  2. Merge your PR
  3. package GitHub Action will run and publish the new version to NuGet.org

๐ŸŽ‰ Getting Started

  1. Install the SSW CA template
dotnet new install SSW.CleanArchitecture.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 Northwind365
cd Northwind365
  1. Create a new solution
dotnet new ssw-ca

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-ca --name {{SolutionName}} --output .\
  1. Create a query
cd src/Application/Features
mkdir {{FeatureName}}
cd {{FeatureName}}
dotnet new ssw-ca-query --name {{QueryName}} --entityName {{Entity}} --namespaceRoot {{Namespace}}
  1. Create a command
cd src/Application/Features
mkdir {{FeatureName}}
cd {{FeatureName}}
dotnet new ssw-ca-command --name {{CommandName}} --entityName {{Entity}} --namespaceRoot {{Namespace}}

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
2024.2.22 829 2/22/2024
1.0.0 151 2/21/2024
0.7.0 2,309 11/27/2023
0.6.0 484 8/15/2023
0.5.0 252 7/22/2023
0.4.0 196 7/3/2023
0.3.0 191 6/6/2023
0.2.3 163 5/22/2023
0.2.2 153 5/15/2023
0.2.1 147 5/15/2023
0.2.0 152 5/10/2023