A practical Task Management System built with .NET 8 that demonstrates clean separation of concerns, SOLID design, and flexible infrastructure. The service exposes a RESTful API for managing tasks and can run either in‑memory or on PostgreSQL with a single switch.
This service lets you create, assign, update, and track tasks. It is intentionally lightweight yet production‑ready:
- Layered Clean Architecture – Presentation ➜ Application ➜ Domain ➜ Infrastructure.
- Dependency Injection – services and repositories are registered in
Program.cs. - Repository Pattern – swap between In‑Memory and PostgreSQL without changing higher layers.
- Extensive Unit Tests – core use‑cases are covered with xUnit + Moq + FluentAssertions.
┌──────────────────────────┐
│ Presentation Layer │ → ASP.NET Core Web API (Delivery)
└───────────────▲──────────┘
│ Calls (DTO)
┌───────────────┴──────────┐
│ Application Layer │ → Use‑Case Interactors (TaskService), Ports, DTOs
└───────────────▲──────────┘
│ Depends on Abstractions
┌───────────────┴──────────┐
│ Domain Layer │ → Entities (TaskItem), Enums, Repository Interfaces
└───────────────▲──────────┘
│ Implemented by
┌───────────────┴──────────┐
│ Infrastructure Layer │ → InMemoryTaskRepository | TaskRepository(EF Core)
└──────────────────────────┘
High‑level policies (Domain/Application) are completely isolated from low‑level concerns (Infrastructure, Web API). Swapping a database, adding RabbitMQ, or migrating to gRPC requires changes only in the outer layers.
| Capability | Description |
|---|---|
| Create Task | POST /api/tasks – title, description, due date, priority, assignee |
| Update Task | PUT /api/tasks/{id} – change status or priority |
| Delete Task | DELETE /api/tasks/{id} |
| List Tasks | GET /api/tasks |
| List by User | GET /api/tasks/user/{userId} |
| Validation | Rejects tasks with due‑date in the past |
| Logging | Key operations are logged via built‑in logging provider |
- .NET 8 SDK
- (Optional) Docker Desktop for containerised run
git clone https://github.com/irvankadhafi/TaskManagement.git
cd TaskManagementcd src/TaskManagement.API
# restore packages & run
dotnet restore
DOTNET_ENVIRONMENT=Development dotnet runThe API listens on https://localhost:5001 and Swagger UI is available at /swagger.
docker‑compose up --build- API → http://localhost:5000
- PostgreSQL exposed on 5432 (credentials in
docker‑compose.yml).
Open the generated Swagger UI to explore and test every endpoint interactively.
Unit tests live under tests/TaskManagement.Application.Tests.
dotnet test tests/TaskManagement.Application.TestsThe suite covers:
- Creating a task (happy & invalid paths)
- Updating status/priority
- Listing tasks (all / by user)
- Deleting tasks
All use‑cases are isolated with mocks, making the tests fast and deterministic.
TaskManagement/
├─ Dockerfile
├─ docker-compose.yml
├─ TaskManagement.sln
├─ src/
│ ├─ TaskManagement.API/ # ASP.NET Core Web API (presentation layer)
│ │ └─ Controllers/ # HTTP endpoints
│ ├─ TaskManagement.Application/ # DTOs, ports, and TaskService interactor
│ ├─ TaskManagement.Contracts/ # Shared contract models between layers
│ ├─ TaskManagement.Delivery.Http/ # (Optional) additional delivery adapters
│ ├─ TaskManagement.Domain/ # Core domain entities & enums
│ ├─ TaskManagement.Infrastructure/ # In‑memory repository (mock DB)
│ ├─ TaskManagement.Persistence/ # EF Core DbContext & PostgreSQL repository
│ └─ TaskManagement.UseCases/ # Reusable use‑case orchestrations
└─ tests/
└─ TaskManagement.Application.Tests/ # Unit tests