A backend application built with Spring Boot 3.5 for efficient task and user management. This system provides a secure API for managing project tasks and tracking progress.
- Task Management: Full CRUD operations for tracking tasks.
- DTO Architecture: Uses Data Transfer Objects (DTOs) for secure and efficient data exchange.
- JWT based authentication and authorization
- Global Error Handling: Consistent API responses and clear error messaging via a global exception handler.
- Java 17
- Spring Boot 3.5.0
- Spring Data JPA
- MySQL (Database)
- Maven (Build Tool)
- JDK 17 or higher
- Maven 3.x
- MySQL Server
Create a .env file in the root directory and configure your database credentials:
DB_URL=jdbc:mysql://localhost:3306/task_management
DB_USERNAME=your_username
DB_PASSWORD=your_password-
Clone the repository:
git clone <repository-url> cd task-management-system
-
Build the project:
./mvnw clean install
-
Run the application:
./mvnw spring-boot:run
Endpoints for user registration, login, and logout.
POST /auth/register
Requires Admin role.
Request Body:
{
"username": "johndoe",
"email": "john@example.com",
"password": "securepassword",
"role": "MEMBER"
}Response:
201 Created: "User created successfully!"
POST /auth/login
Request Body:
{
"email": "john@example.com",
"password": "securepassword"
}Response:
200 OK:{ "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." }
POST /auth/logout
Requires Bearer Token in Authorization header.
Response:
200 OK: "Logged out successfully, token invalidated."
Full CRUD operations for tasks. GET requests are public. All other endpoints require a Bearer Token.
GET /api/tasks
Response:
200 OK:[ { "title": "Setup Project", "description": "Initialize Spring Boot and MySQL", "status": "COMPLETED", "priority": "HIGH", "ownerEmail": "john@example.com", "ownerUsername": "johndoe" } ]
POST /api/tasks
Request Body:
{
"title": "Implement Feature X",
"description": "Details about feature X",
"status": "TODO",
"priority": "MEDIUM"
}Response:
201 Created
PUT /api/tasks/{id}
Requires Admin role or Task Ownership.
Request Body:
{
"title": "Updated Title",
"description": "Updated description",
"status": "IN_PROGRESS",
"priority": "HIGH"
}Response:
200 OK
DELETE /api/tasks/{id}
Requires Admin role or Task Ownership.
Response:
204 No Content
The project includes a comprehensive test suite covering controllers and services.
To run all tests:
./mvnw test