https://github.com/alexandrehtrb/cqrsexample
An example of CQRS architectural pattern on ASP.NET Core.
https://github.com/alexandrehtrb/cqrsexample
api api-testing asp-net-core clean-architecture cqrs cqrs-pattern ddd domain-driven-design dotnet dotnet-core feature-folders hexagonal-architecture nativeaot notification-pattern nullable-reference-types structured-logging swagger-documentation unit-testing
Last synced: about 2 months ago
JSON representation
An example of CQRS architectural pattern on ASP.NET Core.
- Host: GitHub
- URL: https://github.com/alexandrehtrb/cqrsexample
- Owner: alexandrehtrb
- License: mit
- Created: 2021-04-20T17:02:13.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2026-02-23T15:32:47.000Z (4 months ago)
- Last Synced: 2026-02-23T23:36:06.014Z (4 months ago)
- Topics: api, api-testing, asp-net-core, clean-architecture, cqrs, cqrs-pattern, ddd, domain-driven-design, dotnet, dotnet-core, feature-folders, hexagonal-architecture, nativeaot, notification-pattern, nullable-reference-types, structured-logging, swagger-documentation, unit-testing
- Language: C#
- Homepage:
- Size: 122 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# CQRS Example
[Ler em português](README_pt.md)
This project is an example of a shopping list API to show some software architectural concepts, mainly CQRS (Command and Query Responsibility Segregation).
The server is an ASP.NET Minimal API using .NET 10, with as few external dependencies as possible.
## Architectural patterns and programming concepts applied
The links below are for studying and knowledge reference.
* [CQRS pattern](https://docs.microsoft.com/en-us/azure/architecture/patterns/cqrs)
* [Notifications pattern](https://martinfowler.com/articles/replaceThrowWithNotification.html)
* [Feature folders](http://www.kamilgrzybek.com/design/feature-folders/)
* [Structured logging](https://messagetemplates.org/)
* [Nullable type checking](https://docs.microsoft.com/en-us/dotnet/csharp/nullable-references)
* [Unit tests](https://softwaretestingfundamentals.com/unit-testing/)
* [API tests](https://pororoca.io/docs/automated-tests)
* [API documentation with examples](https://guides.scalar.com/scalar/scalar-api-references/net-integration)
## To run the project
The project requires only [.NET 10](https://dotnet.microsoft.com/) installed. The API uses an in-memory database.
The `runserverlocal.ps1` script builds and runs the API, listening on `https://localhost:5001`.
The `rununittests.ps1` script runs the unit tests and generates a testing coverage report at a `TestResults` folder. It requires the [ReportGenerator](https://github.com/danielpalme/ReportGenerator) installed.
## NativeAOT
This project is NativeAOT and trimming compatible, through the `PublishAot` flag. Check out the API project's .csproj to understand how it works.