https://github.com/sswconsulting/ssw.verticalslicearchitecture
An enterprise ready solution template for Vertical Slice Architecture. This template is just one way to apply the Vertical Slice Architecture.
https://github.com/sswconsulting/ssw.verticalslicearchitecture
asp-net-core dotnet ef-core minimal-endpoints software-architecture vertical-slice-architecture
Last synced: about 1 year ago
JSON representation
An enterprise ready solution template for Vertical Slice Architecture. This template is just one way to apply the Vertical Slice Architecture.
- Host: GitHub
- URL: https://github.com/sswconsulting/ssw.verticalslicearchitecture
- Owner: SSWConsulting
- License: mit
- Created: 2023-09-20T05:01:43.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-05-16T23:55:07.000Z (about 2 years ago)
- Last Synced: 2024-05-17T00:42:20.452Z (about 2 years ago)
- Topics: asp-net-core, dotnet, ef-core, minimal-endpoints, software-architecture, vertical-slice-architecture
- Language: C#
- Homepage: https://verticalslicearchitecture.com/
- Size: 238 KB
- Stars: 190
- Watchers: 6
- Forks: 19
- Open Issues: 19
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
[](https://github.com/SSWConsulting/VerticalSliceArchitecture)
# 🤔 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](https://www.ssw.com.au/rules/rules-to-better-vertical-slice-architecture/)
## Learn
[](https://www.youtube.com/watch?v=T-EwN9UqRwE) [](http://lukeparker.dev/blog/vertical-slice-architecture-quick-start)
[
](https://www.youtube.com/watch?v=T-EwN9UqRwE)
# 🎉 Getting Started
To install the template from NuGet.org run the following command:
```bash
dotnet new install SSW.VerticalSliceArchitecture.Template
```
Then create a new solution:
```bash
mkdir Sprout
cd Sprout
dotnet new ssw-vsa
```
Finally, to update the template to the latest version run:
```bash
dotnet new update
```
# 📚 Faster Development
To speed up development there is a `dotnet new` template to create a full Vertical Slice.
```bash
dotnet new ssw-vsa-slice -f Student
```
`-f` or `--feature` where the feature name is the **singular** name of the feature.
Of course, there are always exceptions where appending an 's' is not enough. For example, `Person` becomes `People` and `Child` becomes `Children`.
For this, use the optional parameter:
```bash
dotnet new ssw-vsa-slice -f Person -fp People
```
optional: `-fp` or `--feature-plural` where the feature name is the **plural** name of the feature.
This creates everything you need to get started with a new feature.
- Full CRUD endpoints
- CQRS
- missing `EventHandlers/` folder as this is more uncommon
- provides `Events/` as a folder to demonstrate how to trigger side effects
- Basic REPR pattern (i.e., Request, an Endpoint, and a Response)
- Adds a new Entity
- Basic DDD pattern - the 'Complete' method on the entity shows adding Domain events and using `Result` objects instead of exceptions for validation
- Adds a DbSet to the DbContext
- Adds EF Core Entity Type Configuration
- Adds a Repository
While there is a small amount of code to remove, it is better to push you towards the pit of success, than allow inconsistency.
# 📝 Architecture
```mermaid
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]
```
# ✨ Features
- C# 12
- .NET 8
- ASP.NET Core
- Minimal APIs
- EF Core
- Swagger UI