{"id":37586244,"url":"https://github.com/undrivendev/template-webapi-aspnet","last_synced_at":"2026-01-16T09:46:21.470Z","repository":{"id":63201713,"uuid":"477030478","full_name":"undrivendev/template-webapi-aspnet","owner":"undrivendev","description":"Template for ASP.NET WebApi based applications/microservices using CQRS, Mediator pattern, Clean Architecture","archived":false,"fork":false,"pushed_at":"2024-08-08T22:02:14.000Z","size":182,"stargazers_count":15,"open_issues_count":2,"forks_count":5,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-08-09T23:09:03.331Z","etag":null,"topics":["asp-net","asp-net-core","asp-net-core-web-api","asp-net-web-api","clean-architecture","cqrs","mediator","template","template-project"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/undrivendev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-04-02T11:09:42.000Z","updated_at":"2024-08-08T22:02:15.000Z","dependencies_parsed_at":"2024-03-02T14:47:22.634Z","dependency_job_id":"0cd448f0-a628-4625-90e9-ac689e112e13","html_url":"https://github.com/undrivendev/template-webapi-aspnet","commit_stats":null,"previous_names":[],"tags_count":0,"template":true,"template_full_name":null,"purl":"pkg:github/undrivendev/template-webapi-aspnet","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/undrivendev%2Ftemplate-webapi-aspnet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/undrivendev%2Ftemplate-webapi-aspnet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/undrivendev%2Ftemplate-webapi-aspnet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/undrivendev%2Ftemplate-webapi-aspnet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/undrivendev","download_url":"https://codeload.github.com/undrivendev/template-webapi-aspnet/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/undrivendev%2Ftemplate-webapi-aspnet/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28478049,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-16T06:30:42.265Z","status":"ssl_error","status_checked_at":"2026-01-16T06:30:16.248Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["asp-net","asp-net-core","asp-net-core-web-api","asp-net-web-api","clean-architecture","cqrs","mediator","template","template-project"],"created_at":"2026-01-16T09:46:21.298Z","updated_at":"2026-01-16T09:46:21.451Z","avatar_url":"https://github.com/undrivendev.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ASP.NET Core WebApi template\n\nThis template can be used to bootstrap a working full-fledged ASP.NET Web Api project with a single CLI command (see below).\n\nIt contains what I consider to be best practices/patterns, such as CQRS, Mediator, Clean Architecture.\n\n## :star: Like it? Give a star\nIf you like this project, you learned something from it or you are using it in your applications, please press the star button. Thanks!\n\n## Motivation\nI found implementations of similar samples/templates to often be overly complicated and over-engineered (IMO). This is an effort to create a more approachable, more maintainable solution that can be used as a starting point for the majority of real-world projects while, at the same time, striving to reach a sensible balance between flexibility and complexity.\n\n## Features\n- Based on .NET 8 to have access to the latest features\n- Simplified Startup.cs hosting model\n- [CQRS](https://docs.microsoft.com/en-us/azure/architecture/patterns/cqrs) with full separation between Read and Write repositories\n- Simple [Mediator](https://en.wikipedia.org/wiki/Mediator_pattern) abstraction for CQRS and implementation relying on the chosen Dependency Injection container (see [HumbleMediator](https://github.com/undrivendev/HumbleMediator))\n- Project structure following [Clean Architecture](https://blog.cleancoder.com/uncle-bob/2012/08/13/the-clean-architecture.html) principles\n- Read repositories based on [Dapper](https://dapperlib.github.io/Dapper/) (Raw SQL) for fastest query execution times\n- Write repositories based on [Entity Framework Core](https://github.com/dotnet/efcore) to take advantage on the built-in change tracking mechanism\n- [PostgreSQL](https://www.postgresql.org/) open source database as data store (easily replaceable with any Entity Framework-supported data stores)\n- Database configured to use snake_case naming convention via [EFCore.NamingConventions](https://github.com/efcore/EFCore.NamingConventions)\n- Migrations handled by Entity Framework and automatically applied during startup (in dev environment)\n- [SimpleInjector](https://simpleinjector.org/) open-source DI container integration for advanced service registration scenarios\n- [Aspect-oriented programming](https://en.wikipedia.org/wiki/Aspect-oriented_programming) using [Decorators](https://en.wikipedia.org/wiki/Decorator_pattern) on the above-mentioned mediator\n  - Logging: [QueryHandlerLoggingDecorator](src/Application/Logging/QueryHandlerLoggingDecorator.cs) and [CommandHandlerLoggingDecorator](src/Application/Logging/CommandHandlerLoggingDecorator.cs)\n  - Caching: [QueryHandlerCachingDecorator](src/Application/QueryHandlerCachingDecorator.cs)\n  - Validation: [CommandHandlerValidationDecorator](src/Application/Validation/CommandHandlerValidationDecorator.cs) and [QueryHandlerValidationDecorator](src/Application/Validation/QueryHandlerValidationDecorator.cs)\n- Structured logging using the standard [MEL](https://github.com/dotnet/runtime/tree/main/src/libraries/Microsoft.Extensions.Logging.Abstractions) interface with the open-source [Serilog](https://serilog.net/) logging library implementation\n- Cache-friendly [Dockerfile](src/Api/Dockerfile)\n- Expressive testing using [xUnit](https://xunit.net/) and [FluentAssertions](https://fluentassertions.com/)\n- Integration testing using real database implementation with [Testcontainers](https://dotnet.testcontainers.org/)\n- [Central Package Management](https://learn.microsoft.com/en-us/nuget/consume-packages/Central-Package-Management)\n\n## Usage\n### 1. Bootstrap your project\nHere are a couple of ways to bootstrap a new project starting from this template.\n#### Cookiecutter template\nProbably the best way to bootstrap this project, with just one command, but some dependencies are needed.\n1. Make sure Python is installed\n2. Install [cookiecutter](https://www.cookiecutter.io/).\n3. Bootstrap initial project with the following command: `cookiecutter gh:undrivendev/template-webapi-aspnet --checkout cookiecutter`\n#### GitHub template\nYou could use this project as a GitHub template and clone it in your personal account by using the `Use this template` green button on the top of the page.\n\nThen you'd have to rename classes and namespaces.\n\n\n### 2. Apply initial migration\nWhen you have the project ready, it's time to create the initial migration using [dotnet-ef](https://docs.microsoft.com/en-us/ef/core/cli/dotnet) (or if you use Rider, like me, you can try [this plugin](https://plugins.jetbrains.com/plugin/18147-entity-framework-core-ui)).\n\nHere's an example command using the default solution name, if you changed it you would have to adapt it accordingly:\n\n```sh\ndotnet ef migrations add --project ./src/Infrastructure/Infrastructure.csproj --context AppDbContext --startup-project ./src/Api/Api.csproj InitialMigration\n```\n\nThe above migration is applied automatically during startup in the dev environment.\n\n### 3. Start the application\nThe default API endpoints should be testable from the [Swagger UI](http://localhost:5000/swagger/index.html).\n\nEnjoy!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fundrivendev%2Ftemplate-webapi-aspnet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fundrivendev%2Ftemplate-webapi-aspnet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fundrivendev%2Ftemplate-webapi-aspnet/lists"}