A comprehensive RESTful API for managing todos with user authentication, built using Spring Boot, Spring Data JPA, JWT authentication, and PostgreSQL database.
- User Management: Registration, authentication, and user profile management
- JWT Authentication: Secure token-based authentication system
- Todo Operations: Create, read, update, delete, and toggle todo items
- Admin Functionality: User role management and administrative operations
- Database Integration: PostgreSQL database with JPA/Hibernate
- API Documentation: Interactive Swagger UI for API exploration
- Security: Role-based access control and password encryption
- Exception Handling: Comprehensive error handling and validation
- Framework: Spring Boot 3.x
- Database: PostgreSQL
- ORM: Spring Data JPA with Hibernate
- Authentication: JWT (JSON Web Tokens)
- Security: Spring Security
- Documentation: Swagger/OpenAPI 3
- Build Tool: Maven
- Java Version: Java 21
POST /api/auth/register
- Register new userPOST /api/auth/login
- User login
GET /api/users/profile
- Get current user profilePUT /api/users/password
- Update user passwordDELETE /api/users/delete
- Delete user account
GET /api/todos
- Get all todos for current userPOST /api/todos
- Create new todoPUT /api/todos/{id}
- Update todoDELETE /api/todos/{id}
- Delete todoPUT /api/todos/{id}/toggle
- Toggle todo completion status
GET /api/admin/users
- Get all usersPUT /api/admin/users/{id}/promote
- Promote user to adminDELETE /api/admin/users/{id}
- Delete user (admin only)
- JWT Token Authentication: Stateless authentication using JWT tokens
- Password Encryption: BCrypt hashing for password security
- Role-Based Access Control: Admin and User roles with different permissions
- CORS Configuration: Cross-origin resource sharing setup
- Input Validation: Request validation and sanitization
- Exception Handling: Secure error responses without sensitive information
⭐ If you found this project helpful, please give it a star on GitHub!