A production-style Task Management REST API built using Spring Boot. The application provides task management capabilities along with authentication, authorization, validation, caching, scheduling, and asynchronous processing.
- Create Tasks
- View Tasks
- Update Tasks
- Delete Tasks
- Pagination Support
- JWT Authentication
- User Registration
- User Login
- Role-Based Access Control (RBAC)
- Password Encryption using BCrypt
- Request Validation
- Global Exception Handling
- Custom Error Responses
- Redis Caching
- Cache Invalidation
- API Logging
- Error Logging
- Asynchronous Task Execution
- Scheduled Task Monitoring
- Java 17
- Spring Boot
- Spring Security
- Spring Data JPA
- MySQL
- Redis
- JWT
- Maven
- Lombok
- Hibernate Validation
Client
|
v
Controller Layer
|
v
Service Layer
|
v
Repository Layer
|
v
MySQL Database
Additional Components:
- JWT Authentication
- Redis Cache
- Async Processing
- Scheduler
- Global Exception Handler
src/main/java
├── config
├── controller
├── dto
├── entity
├── exception
├── repository
├── security
├── service
└── util
| Method | Endpoint | Description |
|---|---|---|
| POST | /auth/register | Register User |
| POST | /auth/login | Login User |
| Method | Endpoint | Description |
|---|---|---|
| POST | /tasks | Create Task |
| GET | /tasks | Get All Tasks |
| GET | /tasks/{id} | Get Task By ID |
| PUT | /tasks/{id} | Update Task |
| DELETE | /tasks/{id} | Delete Task |
{
"title": "Learn Spring Boot",
"description": "Build REST APIs",
"completed": false
}- User registers an account.
- User logs in using credentials.
- JWT token is generated.
- Token is sent in the Authorization header.
- Protected APIs are accessed using the token.
Example:
Authorization: Bearer <jwt-token>Configure database credentials using environment variables:
spring.datasource.username=${DB_USERNAME}
spring.datasource.password=${DB_PASSWORD}Example:
DB_USERNAME=root
DB_PASSWORD=your_passwordRedis configuration:
spring.data.redis.host=localhost
spring.data.redis.port=6379git clone <repository-url>mvn clean installmvn spring-boot:runThe application starts on:
http://localhost:8080
Redis caching is used to improve API response times for frequently accessed task data.
Features:
- Task Retrieval Caching
- Automatic Cache Invalidation
- Reduced Database Calls
The application logs:
- Incoming API Requests
- API Responses
- Exceptions
- Validation Failures
Sneha Jaiswal