{"id":33242422,"url":"https://github.com/selfmadecode/cleanarchtemplate","last_synced_at":"2025-11-16T20:02:03.362Z","repository":{"id":322792984,"uuid":"1090908660","full_name":"selfmadecode/CleanArchTemplate","owner":"selfmadecode","description":"A ready-to-use .NET 9 Clean Architecture boilerplate with authentication, EF Core, JWT, logging, and email integration — perfect for scalable enterprise apps.","archived":false,"fork":false,"pushed_at":"2025-11-06T10:39:21.000Z","size":136,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-11-06T12:08:28.217Z","etag":null,"topics":["aspnetcore","clean-architecture","clean-architecture-boilerplate","clean-architecture-template","dotnet","dotnet9","entity-framework-core","sendgrid-integration"],"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/selfmadecode.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-11-06T09:53:13.000Z","updated_at":"2025-11-06T10:39:25.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/selfmadecode/CleanArchTemplate","commit_stats":null,"previous_names":["selfmadecode/cleanarchtemplate"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/selfmadecode/CleanArchTemplate","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/selfmadecode%2FCleanArchTemplate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/selfmadecode%2FCleanArchTemplate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/selfmadecode%2FCleanArchTemplate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/selfmadecode%2FCleanArchTemplate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/selfmadecode","download_url":"https://codeload.github.com/selfmadecode/CleanArchTemplate/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/selfmadecode%2FCleanArchTemplate/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":284767947,"owners_count":27060132,"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","status":"online","status_checked_at":"2025-11-16T02:00:05.974Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["aspnetcore","clean-architecture","clean-architecture-boilerplate","clean-architecture-template","dotnet","dotnet9","entity-framework-core","sendgrid-integration"],"created_at":"2025-11-16T20:01:41.454Z","updated_at":"2025-11-16T20:02:03.347Z","avatar_url":"https://github.com/selfmadecode.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"## CleanArchTemplate (.NET 9 Clean Architecture)\n\n[![License](https://img.shields.io/github/license/selfmadecode/CleanArchTemplate.svg?style=flat)](LICENSE)\n[![Build Status](https://github.com/selfmadecode/CleanArchTemplate/actions/workflows/build.yaml/badge.svg?branch=main)](https://github.com/selfmadecode/CleanArchTemplate/actions/workflows/build.yaml)\n[![.NET ≥ 8.0](https://img.shields.io/badge/.NET-%E2%89%A58.0-512BD4?logo=dotnet\u0026style=flat)](https://dotnet.microsoft.com/)\n[![GitHub issues](https://img.shields.io/github/issues/selfmadecode/CleanArchTemplate.svg?style=flat)](https://github.com/selfmadecode/CleanArchTemplate/issues)\n[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat)](https://github.com/selfmadecode/CleanArchTemplate/pulls)\n\n## About the Project\n\n**CleanArchTemplate** is a fully featured **.NET 9 Clean Architecture** boilerplate project built for rapid enterprise application development.  \nIt provides a ready-to-use foundation with modern best practices and modular layers, so you can quickly rename and launch new projects.\n\n### Key Features\n\n- ✅ **.NET 9 Clean Architecture** pattern  \n- ✅ **Entity Framework Core** with `DbContext`  \n- ✅ **Authentication \u0026 Authorization** using **Roles** and **Policies**  \n- ✅ **JWT with Refresh Tokens**  \n- ✅ **File Upload Support**\n- ✅ **Email Sending via SendGrid and Mailgun** (requires API keys)  \n- ✅ **Email Templates (Account Registration, etc)** ready to use  \n- ✅ **Dependency Injection (DI) Registration**  \n- ✅ **Logging with NLog**  \n- ✅ **Swagger/OpenAPI** documentation  \n- ✅ **Ready to use out-of-the-box** after renaming  \n- ✅ Organized in **four projects**:\n  - `API`\n  - `Application`\n  - `Domain`\n  - `Infrastructure`\n- ✅ Common base types such as:\n  - `EntityBase` (as record)\n  - `ApplicationUser`\n  - DTOs\n\nUse this project as a starting point for scalable, secure, and maintainable .NET applications.\n\n---\n\n# Rename Guide\n\nIf you want to create a new project based on this template (for example, rename **CleanArchTemplate** to **NewProjectName**), follow the steps below.\n\n---\n\n## Step 1 – Close the IDE\n\nClose **Visual Studio**, **Rider**, or **VS Code** before renaming to avoid file locks.\n\n---\n\n## Step 2 – Rename the Solution and Folder\n\nIn **File Explorer**:\n\n1. Rename the main project folder  \n```\nCleanArchTemplate → NewProjectName\n```\n2. Rename the solution file  \n```\nCleanArchTemplate.sln → NewProjectName.sln\n```\n\n---\n\n## Step 3 – Update the Solution File\n\nOpen the `.sln` file in a text editor (Notepad or VS Code) and search for:\n\n```\nProject(\"{GUID}\") = \"CleanArchTemplate\", \"CleanArchTemplate\\CleanArchTemplate.csproj\", \"{GUID}\"\n```\nReplace **CleanArchTemplate** with your new project name:\n```\nProject(\"{GUID}\") = \"NewProjectName\", \"NewProjectName\\NewProjectName.csproj\", \"{GUID}\"\n```\n\nSave and close.\n\n---\n\n## Step 4 – Rename the Project Files (Optional)\n\nIf you wish, rename your `.csproj` files to match:\n\n```\n\nAPI.csproj               → NewProjectName.API.csproj\nApplication.csproj       → NewProjectName.Application.csproj\nInfrastructure.csproj    → NewProjectName.Infrastructure.csproj\nDomain.csproj            → NewProjectName.Domain.csproj\n\n````\n\nThis step is optional; the template will still run with the original file names.\n\n---\n\n## Step 5 – Update Namespaces and References\n\nSearch the entire solution for **`CleanArchTemplate`** and replace it with your new project name, e.g.:\n\n```csharp\nnamespace CleanArchTemplate.API.Controllers\n````\n\nbecomes\n\n```csharp\nnamespace NewProjectName.API.Controllers\n```\n\nAlso update any `\u003cProjectReference\u003e` entries if you renamed `.csproj` files:\n\n```xml\n\u003cProjectReference Include=\"..\\Application\\Application.csproj\" /\u003e\n```\n\nto\n\n```xml\n\u003cProjectReference Include=\"..\\Application\\NewProjectName.Application.csproj\" /\u003e\n```\n\n---\n\n## Step 6 – Update `.csproj` Properties\n\nInside each `.csproj` file, ensure the following reflect your new project name:\n\n```xml\n\u003cPropertyGroup\u003e\n  \u003cRootNamespace\u003eNewProjectName\u003c/RootNamespace\u003e\n  \u003cAssemblyName\u003eNewProjectName\u003c/AssemblyName\u003e\n\u003c/PropertyGroup\u003e\n```\n\n---\n\n## Step 7 – Update App Settings and Database Name\n\nOpen `appsettings.json` in the API project and update your connection string:\n\n```json\n\"ConnectionStrings\": {\n  \"DefaultConnection\": \"Server=...;Database=NewProjectNameDB;...\"\n}\n```\n\n---\n\n## Step 8 – Update Email and SMTP Configuration\n\nIn `appsettings.json`, update the following sections:\n\n### **SmtpConfig**\n\nSet your actual SMTP credentials:\n\n```json\n\"SmtpConfig\": {\n  \"Host\": \"smtp.yourdomain.com\",\n  \"Port\": 587,\n  \"Mail\": \"noreply@yourdomain.com\",\n  \"Password\": \"your_smtp_password\",\n  \"DisplayName\": \"Your App Name\"\n}\n```\n\n### **EmailLink**\n\nUpdate the domain to match your new environment:\n\n```json\n\"EmailLink\": {\n  \"Domain\": \"https://newprojectname.com\"\n}\n```\n\n###  **CORSAllowedOrigins**\n\nAdd your allowed frontend domains:\n\n```json\n\"CORSAllowedOrigins\": [\n  \"https://newprojectname.com\",\n  \"https://admin.newprojectname.com\"\n]\n```\n\nThen open the **Mail Service** class:\n\n```\nApplication/Services/MailService.cs\n```\n\nLocate the method:\n\n```csharp\nSendEmailViaMailgun()\n```\n\nand update the Mailgun **domain** to match your configuration.\n\n---\n\n## Step 9 – Update Swagger Details\n\nGo to:\n`API/Extensions/ServiceCollectionExtensions.cs`\n\nFind `ConfigureSwagger` and change the Swagger title, description, and version text from **CleanArchTemplate** to **NewProjectName**.\n\nIn `Program.cs`, update:\n\n```csharp\napp.UseSwaggerUI(c =\u003e\n{\n    c.SwaggerEndpoint(\"/swagger/v1/swagger.json\", \"CleanArchTemplate\");\n});\n```\n\nto\n\n```csharp\napp.UseSwaggerUI(c =\u003e\n{\n    c.SwaggerEndpoint(\"/swagger/v1/swagger.json\", \"NewProjectName\");\n});\n```\n\n---\n\n## Step 10 – Update Emails and Usernames\n\nSearch for both `CleanArchTemplate` and `@cleanarchtemplate` and replace them with your new project name.\n\nExample:\n\n```\nsuperadmin@cleanarchtemplate.com\n```\n\nbecomes\n\n```\nsuperadmin@newprojectname.com\n```\n\n---\n\n## Step 11 – Run Migrations\n\nTo run or add Entity Framework migrations:\n\n1. In Visual Studio, **set the Infrastructure project as Startup Project**.\n2. Open the Package Manager Console and run:\n\n   ```powershell\n   Add-Migration InitialCreate\n   Update-Database\n   ```\n\n---\n\n## Step 12 – Clean \u0026 Rebuild\n\nAfter renaming:\n\n```bash\ndotnet clean\ndotnet build\n```\n\nRun the API and confirm everything works correctly.\n\n---\n\n# Summary\n\n| Area               | What to Change                                    |\n| ------------------ | ------------------------------------------------- |\n| Solution / Folder  | Rename to your new project name                   |\n| Namespaces         | Replace `CleanArchTemplate` with `NewProjectName` |\n| Emails / Usernames | Replace `@cleanarchtemplate`                      |\n| SMTP Settings      | Update host, mail, password, display name, port   |\n| Email Link         | Update domain                                     |\n| CORS               | Update allowed origins                            |\n| Mail Service       | Update Mailgun domain                             |\n| Swagger            | Update title and endpoint                         |\n| Database           | Update connection string name                     |\n| Migrations         | Run with Infrastructure as startup project        |\n\n---\n\n **That’s it!**\nAfter completing these steps, your new project (**NewProjectName**) will be fully operational — complete with authentication, authorization, Swagger, file upload, EF Core, DI, NLog, and refresh tokens — all ready to go!\n\n---\n\n\u003e  **Tip:** Commit your renamed project as a new GitHub repository to keep this template clean for future reuse.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fselfmadecode%2Fcleanarchtemplate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fselfmadecode%2Fcleanarchtemplate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fselfmadecode%2Fcleanarchtemplate/lists"}