Welcome to the .NET Clean Architecture Starter Template!
This repository serves as a well-structured boilerplate for building scalable .NET applications following clean architecture principles.
This template provides:
- A modular and scalable project structure.
- Clean Architecture principles (Domain-Driven Design).
- Entity Framework Core setup for database management.
- Repository & Service pattern for better code maintainability.
- ASP.NET Identity for authentication & role-based authorization.
- AutoMapper for DTO mapping.
- Middleware setup for security & request handling.
- Dependency Injection for better code organization.
- Exception Handling Middleware (
IHandlerException) to manage errors efficiently. - Scalar API documentation integration for improved OpenAPI documentation.
IdentityManagerAPI/
βββ .gitignore
βββ README.md
βββ appsettings.json
βββ Program.cs
βββ IdentityManagerAPI.http
βββ Controllers/
β βββ AuthUserController.cs
β βββ UserController.cs
βββ Middlewares/
β βββ GlobalExceptionHandler.cs
βββBearerSecuritySchemeTransformer.cs
β
βββ DataAcess/
β βββ Configuration/
β β βββ ApplicationUserConfiguration.cs
β β βββ RoleConfiguration.cs
β βββ Migrations/
β βββ Repos/
β β βββ IRepos/
β β β βββ IImageRepository.cs
β β β βββ IRepository.cs
β β β βββ IUserRepository.cs
β β βββ ImageRepository.cs
β β βββ Repository.cs
β β βββ UserRepository.cs
β βββ ApplicationDbContext.cs
β
βββ IdentityManager.Services/
β βββ ControllerService/
β β βββ IControllerService/
β β β βββ IAuthService.cs
β β β βββ IUserService.cs
β β βββ AuthService.cs
β β βββ UserService.cs
β
β
βββ Models/
β βββ Domain/
β β βββ ApplicationUser.cs
β β βββ Image.cs
β βββ DTOs/
β β βββ Auth/
β β β βββ LoginRequestDTO.cs
β β β βββ LoginResponseDTO.cs
β β β βββ RegisterRequestDTO.cs
β β βββ Image/
β β β βββ ImageUploadRequestDto.cs
β β βββ Mapper/
β β β βββ MappingConfig.cs
β β βββ User/
β β β βββ UserDTO.cs
βββgit clone https://github.com/mrXrobot26/IdentityManagerAPI.git
cd IdentityManagerAPI-
Update Connection String in
appsettings.json:"ConnectionStrings": { "DefaultConnection": "your_database_connection_string_here" }
-
Apply Migrations:
dotnet ef database update
- Uses ASP.NET Core Identity for user authentication & role management.
- Default roles:
Admin,User.
BearerSecuritySchemeTransformer.csfor authentication.- Custom middleware can be added for logging, security, etc.
- Uses DTOs for API request/response models.
- AutoMapper is configured in
MappingConfig.csto handle model transformations.
| Technology | Description |
|---|---|
| .NET Core | Framework for building APIs |
| Entity Framework Core | ORM for database management |
| ASP.NET Identity | Authentication & Authorization |
| AutoMapper | Object-to-object mapping |
| Scalar | API documentation |
| Middleware | Custom request handlers |
| Dependency Injection | Loosely coupled architecture |
Once the application is running, access Scalar UI at:
http://localhost:5025/scalar/v1
- Ensure you have
.NET 9 SDKinstalled. - Run:
dotnet run
- Fork the repo.
- Create a new branch (
feature-branch). - Commit your changes.
- Push to your fork and create a Pull Request.
This template is open-source and constantly evolving.
If you find it useful, give it a star β and contribute! π