This is a RESTful Todo List application built with Spring Boot, PostgreSQL, Flyway, MapStruct, Swagger, and JWT Authentication.
This project provides a robust REST API for managing a todo list, incorporating modern development practices and technologies. Key features include:
- RESTful API: Well-defined endpoints for CRUD operations on todo items.
- PostgreSQL Database: Persistent data storage using a relational database.
- Flyway Database Migrations: Automated database schema management.
- MapStruct: Type-safe bean mapping for efficient data transfer.
- Swagger/OpenAPI: Interactive API documentation for easy testing.
- JWT Authentication: Secure user authentication using JSON Web Tokens.
- Spring Boot
- Java
- PostgreSQL
- Flyway
- MapStruct
- Swagger/OpenAPI 3
- Spring Security with JWT
- Maven
- Java Development Kit (JDK) 17 or higher
- Maven
- PostgreSQL database instance
- A tool like Postman or curl for API testing
-
Clone the repository:
git clone [https://github.com/EricRaw512/TodoList_Springboot.git](https://github.com/EricRaw512/TodoList_Springboot.git)
-
Navigate to the project directory:
cd TodoList_Springboot -
Configure PostgreSQL:
- Create a database.
- Update the
application.propertiesfile with your database credentials.
-
Build the project using Maven:
mvn clean install
-
Run the Spring Boot application:
mvn spring-boot:run
-
The application will be accessible at
http://localhost:8080. -
Access Swagger UI for API documentation:
http://localhost:8080/swagger-ui/index.html
- This API is protected with JWT authentication.
- You will need to register and login to obtain a JWT token.
- Include the
Authorization: Bearer <token>header in your requests.
/api/register: Register a new user./api/login: Login and obtain a JWT token./api/checklist: Get all checklist (requires authentication)./api/checklist: Create checklist (requires authentication)./api/checklist/{checklistId}/item/{checklistItemId}: Get checklist item detail (requires authentication)./api/checklist/{checklistId}/item/{checklistItemId}: Update checklist item status (requires authentication)./api/checklist/{checklistId}/item/{checklistItemId}: Delete a checklist item (requires authentication)./api/checklist/{checklistId}/item/rename/{checklistItemId}: Rename checklist item (requires authentication)./api/checklist/{checklistId}/item: Get all checklist item (requires authentication)./api/checklist/{checklistId}/item: Create checklist item (requires authentication).
-
Register a user:
curl -X POST -H "Content-Type: application/json" -d '{"username": "testuser", "password": "password"}' http://localhost:8080/auth/register
-
Login and get token:
curl -X POST -H "Content-Type: application/json" -d '{"username": "testuser", "password": "password"}' http://localhost:8080/auth/login
-
Get all todos (with token):
curl -H "Authorization: Bearer <your_token>" http://localhost:8080/todos