A secure REST API built with Spring Boot for task management and user authentication.
- User registration and login
- JWT-based authentication
- Passwords hashed with BCrypt
- Full CRUD operations for tasks
- Users can only access their own tasks (authorization, not just authentication)
- MySQL persistence
- Java 21
- Spring Boot
- Spring Security
- Spring Data JPA
- MySQL
- JWT
- Maven
https://task-management-api-u91w.onrender.com
This is a REST API with no frontend — use Postman or curl to interact with it. Note: free-tier hosting means the first request after inactivity may take ~30 seconds to wake up.
Create a MySQL database, then set the required environment variables:
export DB_URL="jdbc:mysql://localhost:3306/taskmanager"
export DB_USERNAME="root"
export DB_PASSWORD="your-password"
export JWT_SECRET="$(openssl rand -base64 32)"
./mvnw spring-boot:runThe API will run at http://localhost:8080.
- POST
/auth/register - POST
/auth/login
- GET
/tasks - GET
/tasks/{id} - POST
/tasks
{
"title": "Finish project"
}- PUT
/tasks/{id} - DELETE
/tasks/{id}
Protected endpoints require a valid JWT token.
The API can be tested using Postman. After logging in, copy the JWT token and use:
Auth → Bearer Token → Paste Token