Skip to content

About

A production-ready Spring Boot 3 & JWT Task Management REST API featuring role-based authorization (USER/ADMIN), paginated filtering, OpenAPI/Swagger UI, H2/MySQL test suites, GitHub Actions CI, and an embedded modern glassmorphic SPA frontend.

Resources

Contributing

Stars

1 star

Watchers

0 watching

Forks

Latest commit

ย 

History

1 Commit

Folders and files

Repository files navigation

๐Ÿ—‚๏ธ Smart Task Manager API

Java Spring Boot MySQL Maven License

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.


โœจ Features

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

๐Ÿ—๏ธ Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚   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.


๐Ÿ“ Project Structure

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/

๐Ÿš€ Quick Start

Prerequisites

Tool Version Notes
JDK 17+ Adoptium or Oracle
Maven 3.9+ Download
MySQL 8+ Download

1. Clone the Repository

git clone https://github.com/YOUR_USERNAME/smart-task-manager-api.git
cd smart-task-manager-api

2. Configure Environment

cp .env.example .env

Edit .env with your database credentials and a strong JWT secret:

# Generate a secure JWT secret:
openssl rand -base64 64

3. Set Up the Database

mysql -u root -p
SOURCE src/main/resources/db/schema.sql;

4. Run the Application

Option A โ€” Direct Maven:

mvn spring-boot:run

Option B โ€” PowerShell helper (Windows):

# Sets up JDK 17 + Maven in current shell
. .\use-java17.ps1
mvn spring-boot:run

Option C โ€” Startup script:

.\scripts\start-app.ps1

5. Access the Application

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

๐Ÿ“– API Reference

Authentication (Public)

Method Endpoint Description
POST /api/auth/register Register a new user
POST /api/auth/login Login and receive JWT

Tasks (JWT Required)

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

Quick cURL Test

# 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"}'

๐Ÿงช Running Tests

mvn test

Test Coverage

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

๐Ÿ” Authentication Flow

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

๐Ÿ“ฎ Postman Collection

  1. Import postman/Smart_Task_Manager_API.postman_collection.json
  2. Create environment with baseUrl = http://localhost:8080
  3. Register โ†’ Login โ†’ Copy token โ†’ Set token variable
  4. Run task CRUD requests

See POSTMAN_GUIDE.md for a step-by-step walkthrough.


๐Ÿค Contributing

Contributions are welcome! Please see CONTRIBUTING.md for guidelines.


๐Ÿ“„ License

This project is licensed under the MIT License โ€” see LICENSE for details.

About

A production-ready Spring Boot 3 & JWT Task Management REST API featuring role-based authorization (USER/ADMIN), paginated filtering, OpenAPI/Swagger UI, H2/MySQL test suites, GitHub Actions CI, and an embedded modern glassmorphic SPA frontend.

Resources

Contributing

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages