A professional-grade User Management & Authentication system built with ASP.NET Core 9, implementing Clean Architecture and CQRS. This project serves as a reference implementation for secure identity management using Identity Core and JWT.
- Clean Architecture: Strict separation of concerns between API, Application, Domain, and Infrastructure layers.
- Identity Core: Robust user management with customized password security policies.
- JWT Authentication: Secure stateless authentication using Bearer tokens with claim-based identity.
- Advanced Exception Handling: Centralized error management using the modern .NET 9
IExceptionHandler(RFC 7807 compliant). - MediatR (CQRS): Decoupled business logic using commands and queries.
- User Context Bridge: Abstracted user identity access via
IUserContextto keep the Application layer pure. - Environment Safety: Secure configuration management via
.envfiles.
- Domain: Contains the
ApplicationUserentity and core business rules. - Application: Features MediatR handlers for Register, Login, and Profile retrieval.
- Infrastructure: Handles EF Core persistence (MariaDB), JWT generation logic, and Identity services.
- API: REST Controllers, Middleware configuration, and Dependency Injection setup.
- Framework: ASP.NET Core 9.0
- Database: MariaDB / MySQL (via Entity Framework Core)
- Patterns: CQRS, Mediator, Dependency Injection, Global Error Handling.
- Libraries: MediatR, Microsoft.AspNetCore.Identity, DotNetEnv.
- Clone the repository:
git clone https://github.com/marvin-dev76/register-system.git- Environment Configuration: Create a .env file in the root directory (refer to .env.example if available) and provide your:
DB_CONNECTION_STRINGJWT_SECRET,JWT_ISSUER, andJWT_AUDIENCE
- Apply Migrations:
dotnet ef database update- Run the Application:
dotnet run --project ./RegisterSystem.APIThis project uses .env files for local development. Never commit the .env file to version control. A .gitignore is included to prevent sensitive data leaks.