A RESTful API for task and project management built with ASP.NET Core 8, featuring JWT authentication, Entity Framework Core, and comprehensive CRUD operations.
- User Authentication: Register and login with JWT token-based authentication
- Task Management: Complete CRUD operations for tasks
- Task Assignment: Assign tasks to specific users
- Status Filtering: Filter tasks by status (Pending, InProgress, Completed)
- Pagination: Efficient data retrieval with pagination support
- Swagger Documentation: Interactive API documentation with built-in authorization testing
- ASP.NET Core 8 - Web API framework
- Entity Framework Core - ORM for database operations
- SQL Server - Database (LocalDB for development)
- JWT Authentication - Secure token-based authentication
- ASP.NET Core Identity - User management
- Swagger/OpenAPI - API documentation
TaskFlow.API/
├── Controllers/ # API endpoints
│ ├── AuthController.cs
│ └── TasksController.cs
├── Models/ # Data models
│ ├── ApplicationUser.cs
│ └── TaskItem.cs
├── DTOs/ # Data transfer objects
│ ├── AuthResponseDto.cs
│ ├── LoginDto.cs
│ ├── RegisterDto.cs
│ └── TaskItemDto.cs
├── Services/ # Business logic
│ ├── AuthService.cs
│ └── IAuthService.cs
├── Repositories/ # Data access layer
│ ├── TaskRepository.cs
│ └── ITaskRepository.cs
├── Data/ # Database context
│ └── ApplicationDbContext.cs
└── Migrations/ # EF Core migrations
- .NET 8 SDK
- SQL Server or SQL Server LocalDB
-
Clone the repository
git clone https://github.com/guidcoimbratt/TaskFlow.API.git cd TaskFlow.API -
Update the database connection string (optional)
Edit
appsettings.jsonif you need to change the connection string:"ConnectionStrings": { "DefaultConnection": "Server=(localdb)\\mssqllocaldb;Database=TaskFlowDb;Trusted_Connection=True;MultipleActiveResultSets=true" }
-
Apply database migrations
dotnet ef database update
-
Run the application
dotnet run
-
Access Swagger UI
Open your browser and navigate to:
https://localhost:7XXX/swagger(port will be displayed in terminal)
POST /api/Auth/register
Content-Type: application/json
{
"email": "user@example.com",
"password": "Password123",
"firstName": "John",
"lastName": "Doe"
}POST /api/Auth/login
Content-Type: application/json
{
"email": "user@example.com",
"password": "Password123"
}Response:
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"email": "user@example.com",
"firstName": "John",
"lastName": "Doe",
"expiresAt": "2026-08-04T13:00:00Z"
}Add the JWT token to your requests:
Authorization: Bearer {your-token-here}
GET /api/Tasks?pageNumber=1&pageSize=10&status=0&assignedToId={userId}Query Parameters:
pageNumber(optional): Page number (default: 1)pageSize(optional): Items per page (default: 10, max: 100)status(optional): Filter by status (0=Pending, 1=InProgress, 2=Completed)assignedToId(optional): Filter by assigned user ID
GET /api/Tasks/{id}POST /api/Tasks
Content-Type: application/json
Authorization: Bearer {token}
{
"title": "Implement user authentication",
"description": "Add JWT authentication to the API",
"dueDate": "2026-08-15T00:00:00Z",
"assignedToId": "user-id-here"
}PUT /api/Tasks/{id}
Content-Type: application/json
Authorization: Bearer {token}
{
"title": "Updated title",
"description": "Updated description",
"status": 1,
"dueDate": "2026-08-20T00:00:00Z"
}DELETE /api/Tasks/{id}
Authorization: Bearer {token}0- Pending1- InProgress2- Completed
- Run the application
- Navigate to the Swagger UI (
https://localhost:7XXX/swagger) - Click "Authorize" button (top right)
- Register a new user via
/api/Auth/register - Login via
/api/Auth/loginto get your JWT token - Copy the token from the response
- Click "Authorize" again and enter:
Bearer {your-token} - Now you can test all authenticated endpoints!
Edit appsettings.json to customize JWT settings:
"Jwt": {
"Key": "YourSuperSecretKeyThatShouldBeAtLeast32CharactersLong!",
"Issuer": "TaskFlowAPI",
"Audience": "TaskFlowClient"
}Important: Never commit sensitive keys to GitHub. Use environment variables or Azure Key Vault in production.
Default password requirements (configured in Program.cs):
- Minimum 6 characters
- At least one digit
- At least one lowercase letter
- At least one uppercase letter
- Id (string, PK)
- Email (string)
- FirstName (string)
- LastName (string)
- CreatedAt (DateTime)
- Id (int, PK)
- Title (string, required, max 200 chars)
- Description (string, max 1000 chars)
- Status (enum: Pending, InProgress, Completed)
- CreatedAt (DateTime)
- UpdatedAt (DateTime, nullable)
- DueDate (DateTime, nullable)
- AssignedToId (string, FK to ApplicationUser)
dotnet run --environment Developmentdotnet ef migrations add MigrationNamedotnet ef database updatedotnet ef migrations remove- Task priority levels
- Task categories/tags
- File attachments
- Task comments
- Email notifications
- Task history/audit log
- Advanced search functionality
- Role-based authorization
Guilherme Coimbra
- GitHub: @guidcoimbratt
This project is open source and available for educational and portfolio purposes.