This project serves as a template for building a Clean Architecture Web API in ASP.NET Core. It focuses on separation of concerns by dividing the application into distinct layers: Domain, Application, Web API, and Infrastructure.
- Clean Architecture structure (Domain, Application, Web API, Infrastructure)
- ASP.NET Core 8.0 with Entity Framework Core
- Docker support with SQL Server integration
- JWT Token & Authentication by identity
- Health Check and Logging
- Unit testing
- Middleware for Exception Handling and Validation
- Integration test, GA pipeline
- Unit test for auth identity code
- fix: scope assign
- .NET 8.0 SDK
- Docker
- SQL Server
-
Clone the repository:
git clone https://github.com/nhonvo/clean-architecture-net-8.0
-
Build and run:
-
Docker:
docker-compose up --build
-
Local: Update the connection string in
appsettings.Development.json
and run:
dotnet run ./src/CleanArchitecture/CleanArchitecture.csproj
-
-
Package project (Optional):
dotnet pack -o nupkg
dotnet new install ./ --force
# dotnet new install ./nupkg/CleanArchitecture.1.0.0.nupkg
dotnet new cleanarch -n template-project
Access the API via:
- Docker:
http://localhost:3001/swagger/index.html
- Health check:
http://localhost:3001/health
&http://localhost:3001/healthcheck-ui
- Health check:
- Local:
http://localhost:5240/swagger/index.html
- Health check:
http://localhost:5240/health
&http://localhost:5240/healthcheck-ui
- Health check:
- Issue tracking and planned features can be found here.
Feel free to contribute by submitting issues or pull requests.
This project is licensed under the MIT License.
For any inquiries, contact the repository owner here.
TODO:
- [ ]: Config integration test, setup docker, run pipeline
- [ ]: Fix warning
- [ ]: Enhance pipeline separate build, unit test, integration test
- [ ]: Config hangfire
- [ ]: Config Job apply sidecar