Skip to content

Rafay-Memon/spring-boot-todo-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Spring Boot Todo REST API

A comprehensive RESTful API for managing todos with user authentication, built using Spring Boot, Spring Data JPA, JWT authentication, and PostgreSQL database.

🚀 Features

  • 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

🛠️ Technologies Used

  • 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

📝 API Endpoints

Authentication

  • POST /api/auth/register - Register new user
  • POST /api/auth/login - User login

User Management

  • GET /api/users/profile - Get current user profile
  • PUT /api/users/password - Update user password
  • DELETE /api/users/delete - Delete user account

Todo Operations

  • GET /api/todos - Get all todos for current user
  • POST /api/todos - Create new todo
  • PUT /api/todos/{id} - Update todo
  • DELETE /api/todos/{id} - Delete todo
  • PUT /api/todos/{id}/toggle - Toggle todo completion status

Admin Operations (Admin Role Required)

  • GET /api/admin/users - Get all users
  • PUT /api/admin/users/{id}/promote - Promote user to admin
  • DELETE /api/admin/users/{id} - Delete user (admin only)

🔒 Security Features

  • 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!

About

A RESTful Todo API built with Spring Boot, JWT authentication, and PostgreSQL

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages