A task management system built with ASP.NET Core microservices, featuring UserService for authentication, TaskService for task management, and an Ocelot gateway for routing. Implements MediatR, CQRS, service layer, Unit of Work, JWT authentication, clean architecture and react front-end.
- User registration and login via minimal APIs (/api/v1/auth/register, /api/v1/auth/login).
- MediatR/CQRS with LoginCommand, RegisterCommand.
- Service layer (IUserService) and Unit of Work (IUnitOfWork).
- Task CRUD via minimal APIs (
/api/v1/tasks). - Repository and Unit of Work pattern for data access.
- JWT authentication with role-based authorization (User/Manager).
- Rate limiting to protect APIs.
- Global error handling with JSON responses.
- EF Core with local SQL Server.
- Swagger with JWT support.
- Modular API endpoints in separate files.
- API Gateway : Routes /api/v1/auth/* to UserService, /api/v1/tasks/* to TaskService.
- Frontend : Built with Vite, React, TypeScript, Ant Design. Task crud with pagination, filtering, sorting, and search.
- Clone the repo:
git clone <url> - Ensure local SQL Server is running and update
appsettings.jsonwith your connection string. - Run migrations:
cd TaskService && dotnet ef database update - Start:
cd TaskService && dotnet run; 'cd ../UserService && dotnet run'; 'cd ../Gateway && dotnet run' - Open
https://localhost:5001/swaggerto test. - Register a user via
/api/v1/auth/register, then login to get a token. - Use the token in Swagger to access task endpoints.
- cd ReactDashboard
- npm install
- npm run dev
- Access dashboard at http://localhost:3000
- ASP.NET Core 8
- EF Core
- SQL Server (local)
- JWT Authentication
- Swagger
- MediatR (CQRS)
- Ocelot Gateway
- React, Vite, TypeScript, Ant Design
- Open https://localhost:5001/swagger (TaskService) or https://localhost:5002/swagger (UserService) to test APIs.
- Register a user via POST /api/v1/auth/register (e.g., { "username": "testuser", "password": "Password123!" }).
- Login via POST /api/v1/auth/login to get a JWT token.
- Use token in Swagger or frontend to access task endpoints via Ocelot (https://localhost:5000).
- Login at http://localhost:3000/login (e.g., testuser, Password123!).
- Navigate to /tasks to manage tasks.
- Ensure Jwt:Key, Issuer, Audience match across UserService and TaskService.
- Ocelot runs on https://localhost:5000, routing to UserService (5002) and TaskService (5001).
- Rate limiting: 10 requests/sec general, 5 login attempts/min.
- Manager role required for deleting tasks.
- Next: Kafka implementation - enables asynchronous and decoupled message exchange between microservices.