A modern ASP.NET Core 10 Web API demonstrating enterprise-level architecture patterns and best practices for task management.
This project implements Clean Architecture with clear separation of concerns:
src/
βββ TodoTasks.API/ # Web API Layer (Controllers, Program.cs)
βββ TodoTasks.Application/ # Business Logic Layer (Services, Interfaces)
βββ TodoTasks.Domain/ # Domain Layer (Entities, Value Objects, Repositories)
βββ TodoTasks.Infrastructure/ # Data Access Layer (EF Core, Repositories)
- Clean Architecture with dependency inversion
- Domain-Driven Design principles
- JWT Authentication for secure API access
- Entity Framework Core 10 with SQL Server
- Repository Pattern for data access abstraction
- Rich Domain Models with business logic encapsulation
- Value Objects for type-safe operations
- Swagger/OpenAPI documentation with Bearer token support
- Unit Tests for Application and Domain layers
- Dependency Injection throughout all layers
- .NET 10 - Latest framework version
- ASP.NET Core Web API - RESTful API framework
- Entity Framework Core 10 - ORM for data access
- SQL Server - Database provider
- JWT Bearer Authentication - Secure token-based authentication
- Swashbuckle.AspNetCore 6.9 - API documentation with Bearer support
- xUnit - Unit testing framework
- C# 13 - Latest language features
- Rich domain model with business rules
- Encapsulated state changes through methods
- Validation at domain level
- Support for categories, due dates, and assignments
- Color-coded task categorization
- Validation for name length and format
- Update tracking with timestamps
- Domain Layer: Pure business logic, no external dependencies
- Application Layer: Use cases and business workflows
- Infrastructure Layer: External concerns (database, external APIs)
- API Layer: HTTP concerns and request/response handling
- Entities with identity and lifecycle
- Value Objects for immutable data structures
- Repository Interfaces in domain layer
- Domain Services for complex business operations
- Code-First approach with migrations
- Seed Data for initial categories and tasks
- Relationship Configuration between entities
- Repository Pattern implementation
- .NET 10 SDK
- SQL Server (LocalDB or full instance)
- Visual Studio 2024 or VS Code
- Clone the repository
- Update connection string in
appsettings.json - Run database migrations:
dotnet ef database update --project src/TodoTasks.API
- Start the application:
dotnet run --project src/TodoTasks.API
Navigate to /swagger when running in development mode to explore the API endpoints.
Testing Protected Endpoints:
- Use
/api/auth/loginto get a JWT token - Click the Authorize button in Swagger UI
- Enter your JWT token
- Test protected endpoints
The application includes seed data with:
- 3 Categories: Work, Personal, Shopping (with color coding)
- 3 Sample Tasks: Demonstrating different states and categories
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/auth/register |
Register new user |
| POST | /api/auth/login |
Login and get JWT token |
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/todotasks |
Get all tasks |
| GET | /api/todotasks/{id} |
Get task by ID |
| POST | /api/todotasks |
Create new task |
| PUT | /api/todotasks/{id} |
Update existing task |
| DELETE | /api/todotasks/{id} |
Delete task |
| POST | /api/todotasks/{id}/complete |
Mark task as complete |
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/categories |
Get all categories |
| GET | /api/categories/{id} |
Get category by ID |
| POST | /api/categories |
Create new category |
| PUT | /api/categories/{id} |
Update existing category |
| DELETE | /api/categories/{id} |
Delete category |
- β Web API Development - RESTful API design
- β JWT Authentication - Token-based security
- β Dependency Injection - Built-in DI container usage
- β Configuration Management - appsettings.json handling
- β Middleware Pipeline - HTTP request processing
- β Model Binding & Validation - Request/response handling
- β Swagger Integration - API documentation with Bearer auth
- β Clean Architecture - Layered application design
- β Repository Pattern - Data access abstraction
- β Dependency Inversion - Interface-based programming
- β Domain-Driven Design - Rich domain models
- β SOLID Principles - Clean, maintainable code
- β Code-First Migrations - Database schema management
- β DbContext Configuration - Database context setup
- β Relationship Mapping - Entity relationships
- β Seed Data - Initial data population
- β Async Operations - Non-blocking database operations
- β Unit Tests - Application layer service tests
- β Domain Tests - Domain entity and value object tests
- β xUnit Framework - Modern testing practices
- β Test Isolation - Independent test execution
- β Nullable Reference Types - Null safety
- β Record Types - Immutable data structures
- β Pattern Matching - Modern C# syntax
- β Primary Constructors - Concise constructor syntax
- β Global Using Statements - Reduced boilerplate
- β Authentication & Authorization (JWT) - Secure token-based auth
- β Unit Tests - Application and Domain layer coverage
- CQRS with MediatR
- Integration Tests
- Docker containerization
- CI/CD pipeline
- Caching with Redis
- Logging with Serilog
- Health checks
- Rate limiting
- API versioning
This project demonstrates production-ready ASP.NET Core development practices suitable for enterprise applications.