Announcing the SSW Clean Architecture Template!
Large enterprise .NET projects come in all shapes and sizes, but at SSW we’ve always had a desire to make it follow a whole bunch of rules so that we incorporate all the best practices from past projects. A huge benefit is when a software developer moves from one client to another, the structure looks very familiar, and therefore they can get into the business problem quicker.
When you start a new project, it can take ages, weeks to get the API into a decent shape. What I’m going to announce today will make a ton of .NET developers very happy, because they can get the best practices solution now in minutes.
Since .NET 1.0, SSW has always had a ‘data guy’, who is in charge of best practices around structuring software projects.
A year ago, again I got some of my Solution Architects, Daniel M., William L., Matt G., Matt W., Chris C., as well as young gun Luke P. together and we spent a few wonderful days in Mittagong on an “Architecture Retreat”. In between fancy dinners, lunches, and breakfasts, one of our goals was to decide what our general architectural recommendations should be going forward. As a result, we decided to create an open-source project: SSW Clean Architecture Template (aka SSW CA) which the team has been using and working on for the past year.
We have now decided that the template has matured enough to announce it as GA (Generally Available)! 🥳
✅ You can find the template GitHub here: github.com/SSWConsulting/SSW.CleanArchitecture
The main driver behind building an SSW template was to rapidly kick-start client projects in a consistent way that aligns with SSW’s best practices. This template is not only used on SSW projects, but you can also learn it from our Clean Architecture 1-day Superpowers and 2-day Workshop events.
We are also doing regular Community Updates which are posted to the Software Architecture Whiterobes (SAW) YouTube channel. Check out the content and let us know what you think!
✨ Features
- 🔨
dotnet new
cli template – to get you started quickly - 📦 Slim – no authentication provider, no authorization & no UI framework
- You can add these yourself or use one of our reference architectures from awesome-clean-architecture
- as per ssw.com.au/rules/choosing-authentication/
- 🎯 Domain Driven Design Patterns
- Super Hero Domain
- AggregateRoot
- Entity
- ValueObject
- DomainEvent
- 🌐 Minimal Endpoints – because it’s fast & simple. ⚡
- Extension methods to ensure consistent HTTP Verbs & Status Codes
- 📝 OpenAPI/Swagger – 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
- Comes with Migrations & Data Seeding
- as per ssw.com.au/rules/rules-to-better-entity-framework/
- 🧩 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 ofint
, orGuid
- Entity Framework can automatically convert the int, Guid, nvarchar(..) to strongly typed ID.
- e.g. pass
- 📁 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
- Consistent build configuration across all projects in the solution
- ⚖️ EditorConfig – comes with the SSW.EditorConfig
- Maintain consistent coding styles for individual developers or teams of developers working on the same project using different IDEs
- 🧪 Testing
- as per ssw.com.au/rules/rules-to-better-testing/
- Simpler Unit Tests for Application
- No Entity Framework mocking required thanks to Specifications
- as per ssw.com.au/rules/rules-to-better-unit-tests/
- 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
The template is open source and we have a lot of exciting upcoming features. If you have any feedback please submit a GitHub Issue.
If you need help on any architecture-related matters, feel free to get in touch: ssw.com.au/company/contact-us