A production-ready Task Manager REST API built using Spring Boot. The application supports secure authentication using JWT, role-based authorization, and user-specific data access.
- Java
- Spring Boot
- Spring Security
- JWT (JSON Web Token)
- Spring Data JPA
- MySQL
- Hibernate
- Maven
- Swagger (OpenAPI)
- JWT-based authentication (stateless)
- Custom JWT filter for request validation
- Secure login endpoint
- Role-based access control (USER / ADMIN)
- Admin can access all tasks
- Users can only access their own tasks
- Ownership enforced at service layer
- Create, Read, Update, Delete Tasks
- Pagination & sorting using Pageable
- DTO-based architecture
- API response wrapper for consistent responses
- Global exception handling with structured error responses
- Validation with field-level error messages
- Swagger UI integrated
- JWT authorization supported in Swagger
- Controller → Handles API requests
- Service → Business logic & security checks
- Repository → Database interaction
- Security Layer → JWT authentication & authorization
- User logs in via /auth/login
- Server returns JWT token
- Client sends token in header:
- Authorization: Bearer
- JWT filter validates token for each request
- Access granted based on role and ownership
- POST /auth/register
- POST /auth/login
GET /tasks?page=0&size=5&sortBy=id
GET /tasks/{id}
PUT /tasks/{id}
DELETE /tasks/{id}
Standard error response format:
{
"timestamp": "...",
"status": 404,
"error": "Not Found",
"message": "...",
"path": "/tasks/1"
}
- Clone the repository
- git clone https://github.com/dbybek/TaskManagerApplication.git
- Navigate to project
- cd TaskManagerApplication
- Configure database in application.properties
- Build project
- mvn clean install
- Run application
- mvn spring-boot
URL: http://localhost:8080/swagger-ui.html
Steps:
- Call /auth/login
- Copy JWT token
- Click Authorize
- Enter: Bearer
- Access secured APIs
- Task search & filtering
- Refresh token implementation
- Rate limiting
- Unit & integration testing
Bibek Swain