The Problem: "Boilerplate Hell"
Weโve all been there. You have a great idea for a new .NET API. You open Visual Studio, create a new project, and then... you spend the next two days setting up the same things you set up for your last five projects:
- ๐ Setting up the folder structure.
- ๐ Configuring ASP.NET Core Identity.
- ๐ Writing the JWT token generation logic.
- ๐ง Figuring out email verification.
- ๐ configuring Serilog because the default logger isn't enough.
- ๐๏ธ Implementing a standardized API response wrapper.
Itโs tedious, repetitive, and kills your momentum.
The Solution: CleanAuthTemplate
I built CleanAuthTemplate to solve exactly this problem. It is a robust, production-ready starter kit built on Clean Architecture principles. It comes pre-loaded with everything you need to secure and structure an enterprise-level application, so you can start writing business logic on Day 1.
Whatโs Inside?
This isn't just a "Hello World" app. Itโs a fully structured solution containing:
- Clean Architecture: Strict separation of concerns (Domain, Application, Infrastructure, API).
- Security First: Pre-configured Identity and JWT Authentication (Access Tokens) with Role-Based Authorization (Admin/User).
- Email Ready: Integrated MailKit with html templates for email verification flows.
- Observability: Structured logging with Serilog (console & rolling file logs).
- Best Practices: Global Exception Handling and standardized API responses.
How to Use It (The Easy Way)
You don't need to manually copy-paste files. Iโve designed this to work as a native .NET Project Template. Here is how you can install it and generate a new project in less than a minute:
- Install the Template Clone the repo and install it into your .NET CLI. This registers the template locally on your machine.
git clone https://github.com/dabananda/CleanAuthTemplate.git
cd CleanAuthTemplate
dotnet new install .
- Generate Your New Project Now, you can create a new solution anywhere on your computer using the cleanauth command. The CLI will automatically rename all namespaces and files to match your new project name!
# Create a new project named "MySuperApp"
dotnet new cleanauth -n MySuperApp
- Run & Go Update your connection strings in appsettings.json, run the migrations, and you are live.
dotnet ef database update
dotnet run
๐ค Why Clean Architecture?
The template follows the dependency rule where dependencies flow inward. This ensures your core business logic (Domain and Application layers) remains independent of external frameworks and databases, making your app easier to test and maintain in the long run.
๐ Links & Resources
GitHub Repository: github.com/dabananda/CleanAuthTemplate
If this template saves you some time, please consider giving the repo a โญ star! Iโm actively looking for feedback, so feel free to open an issue or drop a comment below.
Happy Coding! ๐ป

Top comments (0)