Production-grade REST API for task management with JWT authentication, role-based access control, and a built-in web frontend โ all powered by Spring Boot 3.
| Category | Details |
|---|---|
| ๐ Authentication | JWT-based register/login with BCrypt password hashing |
| ๐ฅ Authorization | Role-based access โ USER sees own tasks, ADMIN sees all |
| ๐ Task CRUD | Create, read, update, delete with full validation |
| ๐ Advanced Querying | Filter by status/priority, sort by any field, paginated responses |
| ๐จ Built-in Frontend | Responsive SPA served directly from Spring Boot |
| ๐งช Test Suite | Unit + web-layer tests (JUnit 5 ยท Mockito ยท MockMvc) |
| ๐ฎ Postman Collection | Ready-to-import collection for quick API testing |
| ๐ Swagger UI | Auto-generated interactive API docs at /swagger-ui.html |
| ๐ Health Checks | Spring Actuator endpoints at /actuator/health |
โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโ
โ Frontend โโโโโโถโ Controller โโโโโโถโ Service โโโโโโถโ MySQL โ
โ (Static JS) โ โ (REST) โ โ (Business) โ โ DB โ
โโโโโโโโโโโโโโโโ โโโโโโโโฌโโโโโโโโ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโ
โ
โโโโโโโโดโโโโโโโโ
โ JWT Security โ
โ Filter โ
โโโโโโโโโโโโโโโโ
Layered design: Controller โ Service โ Repository, with DTOs at boundaries and a global exception handler for consistent error responses.
smart-task-manager-api/
โโโ pom.xml # Maven build config
โโโ .env.example # Environment variable template
โโโ README.md
โโโ CHANGELOG.md
โโโ CONTRIBUTING.md
โโโ LICENSE
โโโ POSTMAN_GUIDE.md
โโโ RUNNING.md
โโโ design.md # UI/UX design blueprint
โโโ use-java17.ps1 # JDK 17 shell helper
โโโ scripts/
โ โโโ start-app.ps1 # Auto-detect Java & run
โโโ postman/
โ โโโ Smart_Task_Manager_API.postman_collection.json
โโโ docs/
โ โโโ internal/ # Developer notes (not user-facing)
โโโ frontend-designs/ # Stitch UI design exports
โโโ src/
โโโ main/
โ โโโ java/com/smarttaskmanager/api/
โ โ โโโ SmartTaskManagerApiApplication.java
โ โ โโโ config/
โ โ โ โโโ SecurityConfig.java
โ โ โ โโโ CorsConfig.java
โ โ โ โโโ OpenApiConfig.java
โ โ โโโ controller/
โ โ โ โโโ AuthController.java
โ โ โ โโโ TaskController.java
โ โ โโโ dto/
โ โ โ โโโ auth/
โ โ โ โโโ task/
โ โ โโโ entity/
โ โ โ โโโ User.java
โ โ โ โโโ Task.java
โ โ โโโ enums/
โ โ โโโ exception/
โ โ โโโ repository/
โ โ โโโ security/
โ โ โโโ service/
โ โโโ resources/
โ โโโ application.properties
โ โโโ application-test.properties
โ โโโ db/schema.sql
โ โโโ static/ # Built-in frontend
โโโ test/
โโโ java/com/smarttaskmanager/api/
โโโ controller/
โโโ service/impl/
| Tool | Version | Notes |
|---|---|---|
| JDK | 17+ | Adoptium or Oracle |
| Maven | 3.9+ | Download |
| MySQL | 8+ | Download |
git clone https://github.com/YOUR_USERNAME/smart-task-manager-api.git
cd smart-task-manager-apicp .env.example .envEdit .env with your database credentials and a strong JWT secret:
# Generate a secure JWT secret:
openssl rand -base64 64mysql -u root -p
SOURCE src/main/resources/db/schema.sql;Option A โ Direct Maven:
mvn spring-boot:runOption B โ PowerShell helper (Windows):
# Sets up JDK 17 + Maven in current shell
. .\use-java17.ps1
mvn spring-boot:runOption C โ Startup script:
.\scripts\start-app.ps1| URL | Description |
|---|---|
http://localhost:8080 |
Web frontend (login/signup/dashboard) |
http://localhost:8080/swagger-ui.html |
Interactive API documentation |
http://localhost:8080/actuator/health |
Health check endpoint |
| Method | Endpoint | Description |
|---|---|---|
POST |
/api/auth/register |
Register a new user |
POST |
/api/auth/login |
Login and receive JWT |
| Method | Endpoint | Description |
|---|---|---|
POST |
/api/tasks |
Create a new task |
GET |
/api/tasks |
List tasks (paginated, filterable) |
GET |
/api/tasks/{id} |
Get a single task |
PUT |
/api/tasks/{id} |
Update a task |
DELETE |
/api/tasks/{id} |
Delete a task |
Query Parameters for GET /api/tasks:
| Param | Default | Options |
|---|---|---|
page |
0 |
Page number |
size |
10 |
Page size |
sortBy |
createdAt |
Any task field |
sortDir |
desc |
asc / desc |
status |
โ | TODO ยท IN_PROGRESS ยท COMPLETED |
priority |
โ | LOW ยท MEDIUM ยท HIGH |
# Register
curl -X POST http://localhost:8080/api/auth/register \
-H "Content-Type: application/json" \
-d '{"name":"Test User","email":"test@example.com","password":"password123","role":"USER"}'
# Login
curl -X POST http://localhost:8080/api/auth/login \
-H "Content-Type: application/json" \
-d '{"email":"test@example.com","password":"password123"}'
# Create Task (use token from login response)
curl -X POST http://localhost:8080/api/tasks \
-H "Authorization: Bearer <JWT_TOKEN>" \
-H "Content-Type: application/json" \
-d '{"title":"My Task","description":"Details","status":"TODO","priority":"HIGH","dueDate":"2030-12-31"}'mvn test| Test Class | Layer | Scenarios |
|---|---|---|
AuthServiceImplTest |
Service | Register/login success + failure |
TaskServiceImplTest |
Service | CRUD, ownership checks, admin behavior |
AuthControllerTest |
Web | Validation, response codes |
TaskControllerTest |
Web | Create/get tasks, pagination |
1. Client โโPOST /api/auth/registerโโโถ Server
2. Server โโโ 201 { token, user } โโ Server
3. Client โโGET /api/tasksโโโถ Server
Authorization: Bearer <token>
4. JwtAuthenticationFilter validates token
5. SecurityContext set โ request proceeds
6. Service enforces role + ownership rules
- Import
postman/Smart_Task_Manager_API.postman_collection.json - Create environment with
baseUrl = http://localhost:8080 - Register โ Login โ Copy token โ Set
tokenvariable - Run task CRUD requests
See POSTMAN_GUIDE.md for a step-by-step walkthrough.
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
This project is licensed under the MIT License โ see LICENSE for details.