{"id":29040412,"url":"https://github.com/deadislove/dotnet-cleanarchmediatr-template","last_synced_at":"2026-04-10T14:40:51.846Z","repository":{"id":296364153,"uuid":"993106750","full_name":"deadislove/dotnet-CleanArchMediatR-template","owner":"deadislove","description":"A modular and scalable .NET template built with Clean Architecture and MediatR. Supports DDD, CQRS, multiple databases, Serilog logging, JWT auth, and unit testing out of the box.","archived":false,"fork":false,"pushed_at":"2025-06-23T00:57:19.000Z","size":23715,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-06-26T14:05:30.370Z","etag":null,"topics":["automapper","clean-architecture","cqrs-pattern","docker","docker-compose","dotnet","fluentvalidation","jwt-authentication","mediatr","mssql","postgresql","serilog","sqlite","xunit"],"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/deadislove.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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,"zenodo":null}},"created_at":"2025-05-30T08:20:14.000Z","updated_at":"2025-06-23T00:57:22.000Z","dependencies_parsed_at":"2025-05-30T11:26:07.791Z","dependency_job_id":null,"html_url":"https://github.com/deadislove/dotnet-CleanArchMediatR-template","commit_stats":null,"previous_names":["deadislove/dotnet-cleanarchmediatr-template"],"tags_count":1,"template":true,"template_full_name":null,"purl":"pkg:github/deadislove/dotnet-CleanArchMediatR-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deadislove%2Fdotnet-CleanArchMediatR-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deadislove%2Fdotnet-CleanArchMediatR-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deadislove%2Fdotnet-CleanArchMediatR-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deadislove%2Fdotnet-CleanArchMediatR-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/deadislove","download_url":"https://codeload.github.com/deadislove/dotnet-CleanArchMediatR-template/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deadislove%2Fdotnet-CleanArchMediatR-template/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262081117,"owners_count":23255662,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["automapper","clean-architecture","cqrs-pattern","docker","docker-compose","dotnet","fluentvalidation","jwt-authentication","mediatr","mssql","postgresql","serilog","sqlite","xunit"],"created_at":"2025-06-26T14:05:19.933Z","updated_at":"2025-12-30T20:06:07.093Z","avatar_url":"https://github.com/deadislove.png","language":"C#","funding_links":["https://ko-fi.com/F1F82YR41'"],"categories":[],"sub_categories":[],"readme":"# CleanArchMediatR.Template\r\n\r\n![Visitors](https://img.shields.io/badge/visitors-null_total-brightgreen)\r\n![Clones](https://img.shields.io/badge/clones-null_total_null_unique-blue) \u003c!--CLONE-BADGE--\u003e\r\n\r\n## Description \r\n\r\nA modular .NET template project that implements Clean Architecture and MediatR, designed for scalable, testable, and maintainable enterprise applications. This solution also supports multiple database providers via factory abstraction and integrates JWT-based authentication with clear separation of concerns.\r\n\r\n\u003ca href='https://ko-fi.com/F1F82YR41' target='_blank'\u003e\u003cimg height='36' style='border:0px;height:36px;' src='https://storage.ko-fi.com/cdn/kofi6.png?v=6' border='0' alt='Buy Me a Coffee at ko-fi.com' /\u003e\u003c/a\u003e\r\n\r\n## 🚀 Features\r\n\r\n- ✅ Clean Architecture (Application, Domain, Infra, API, Shared)\r\n- ✅ CQRS with MediatR\r\n- ✅ FluentValidation for request validation\r\n- ✅ Serilog for structured logging\r\n- ✅ JWT Authentication\r\n- ✅ Modular DB support (MSSQL, PostgreSQL, SQLite via Docker Compose)\r\n- ✅ Layered service abstraction (facade, repository, service)\r\n- ✅ AutoMapper integration\r\n- ✅ Docker-compatible\r\n- ✅ xUnit Testing for Handlers\r\n- ✅ Custom Middleware for exceptions and meta-filling\r\n\r\n## 🧱 Folder Highlights\r\n\r\n| Folder / Project                                    | Description                                                              |\r\n| --------------------------------------------------- | ------------------------------------------------------------------------ |\r\n| `src/CleanArchMediatR.Template.Api`                 | ASP.NET Core API project, entry point of the application                 |\r\n| `src/CleanArchMediatR.Template.Application`         | Business logic with CQRS (Commands, Queries, Handlers, DTOs, Validators) |\r\n| `src/CleanArchMediatR.Template.Domain`              | Domain layer with Entities, Interfaces, Services, and Exceptions         |\r\n| `src/CleanArchMediatR.Template.Infra`               | Infrastructure logic (EF Core, Jwt, Logging, Repositories)               |\r\n| `src/CleanArchMediatR.Template.PersistenceFactory`  | Database factory abstraction to support multiple DBs                     |\r\n| `src/CleanArchMediatR.Template.Shared`              | Shared constants and utilities                                           |\r\n| `tests/CleanArchMediatR.Template.Application.Tests` | xUnit tests for application layer                                        |\r\n| `docker-compose.*.yml`                              | Scripts for launching various databases via Docker                       |\r\n\r\n## 🧪 Running Tests\r\n\r\n```bash\r\ncd tests/CleanArchMediatR.Template.Application.Tests\r\ndotnet test\r\n```\r\n\r\n## 🛠️ How to Run\r\n\r\n```bash\r\n# Launch database with docker (choose one)\r\ndocker-compose -f docker-compose.sqlite.yml up -d\r\n\r\n# Build and run API\r\ncd src/CleanArchMediatR.Template.Api\r\ndotnet run\r\n```\r\n\r\n## 📦 Prerequisites\r\n\r\n- [.NET 9 SDK](https://dotnet.microsoft.com/en-us/download/dotnet/9.0)\r\n- [Docker](https://www.docker.com/) (if using provided database images)\r\n\r\n## 🧠 Architecture Overview\r\n\r\nThe solution follows Clean Architecture principles:\r\n\r\n```bash\r\nAPI (Controller)\r\n  └── Application Layer (Commands, Queries, Handlers)\r\n       └── Domain Layer (Entities, Interfaces)\r\n            └── Infrastructure (EFCore, Jwt, Logging)\r\n```\r\n\r\nDecoupling is achieved via abstractions and dependency injection. The PersistenceFactory adds flexibility for database provider configuration.\r\n\r\n## ⚙️ Customize the Template\r\n\r\nTo start your own project based on this template:\r\n\r\n```bash\r\ndotnet new install CleanArchMediatR.Template\r\ndotnet new cleanarch-mediatr -n YourProjectName\r\n```\r\n\r\n## 📌 Other Notes\r\n\r\n- SQLite DB (app.db) is used for lightweight development.\r\n- Logs are saved in logs/ directory.\r\n- HTTP samples can be tested with *.http files in API project.\r\n\r\n## Stay in touch\r\n\r\n- Author - [Da-Wei Lin](https://www.linkedin.com/in/da-wei-lin-689a35107/)\r\n- Website - [David Weblog](https://davidskyspace.com/)\r\n- [MIT LICENSE](https://github.com/deadislove/dotnet-CleanArchMediatR-template/blob/main/LICENSE.md)\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeadislove%2Fdotnet-cleanarchmediatr-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdeadislove%2Fdotnet-cleanarchmediatr-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeadislove%2Fdotnet-cleanarchmediatr-template/lists"}