Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lucasdota/todo_app_backend
A simple and secure Todo application built with Java Spring Boot, featuring user authentication via email and password, and JWT-based session management stored in cookies. This application allows users to register, log in, and manage their personal todo lists with full CRUD functionality.
https://github.com/lucasdota/todo_app_backend
crud java jwt mysql spring-boot
Last synced: 2 days ago
JSON representation
A simple and secure Todo application built with Java Spring Boot, featuring user authentication via email and password, and JWT-based session management stored in cookies. This application allows users to register, log in, and manage their personal todo lists with full CRUD functionality.
- Host: GitHub
- URL: https://github.com/lucasdota/todo_app_backend
- Owner: Lucasdota
- License: mit
- Created: 2024-12-27T21:27:10.000Z (about 1 month ago)
- Default Branch: master
- Last Pushed: 2024-12-27T22:04:30.000Z (about 1 month ago)
- Last Synced: 2024-12-27T23:32:46.038Z (about 1 month ago)
- Topics: crud, java, jwt, mysql, spring-boot
- Language: Java
- Homepage:
- Size: 28.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Todo Application with Spring Boot
[![NPM](https://img.shields.io/npm/l/react)](https://github.com/Lucasdota/todo_app_backend/blob/master/LICENSE)This is a Todo application built with Java Spring Boot. The application allows users to register, log in using their email and password, and manage their todo items. Authentication is handled using JSON Web Tokens (JWT), which are stored in cookies for secure session management.
## Features
- User registration and login
- JWT-based authentication
- Secure cookie storage for JWT
- CRUD operations for todo items
- User-specific todo lists## Technologies Used
- Java 21
- Spring Boot 2.x
- Spring Security
- JWT (JSON Web Tokens)
- Maven## Prerequisites
- Java 21 or higher
- Maven
- IDE (e.g., IntelliJ IDEA, Eclipse)## Getting Started
### Clone the Repository
```bash
git clone https://github.com/Lucasdota/todo_app_backend.git
cd todo_app_backend
```### Build the Application
Make sure you have Maven installed. You can build the application using the following command:
```bash
mvn clean install
```### Create the application.properties file inside the src/main/resources folder
```bash
spring.application.name=your_app_name
spring.datasource.url=jdbc:your_db_url
spring.datasource.username=your_db_username
spring.datasource.password=your_db_passwordspring.jpa.hibernate.ddl-auto=update
spring.jpa.show-sql=truejwt.cookie.name=token
jwt.secret=${JWT_SECRET:your_jwt_secret}
```### Run the application
You can run the application using the following command:
```bash
mvn spring-boot:run
```
The application will start on http://localhost:8080## API Endpoints
### User Registration
- #### POST: /auth/register
- ```javascript
{ "email": "[email protected]", "password": "yourpassword"}
```### User Login
- #### POST: /auth/login
- ```javascript
{ "email": "[email protected]", "password": "yourpassword"}
```### User Logout
- #### POST: /auth/logout### Create Todo
- #### POST: /todo
- ```javascript
{ "userId": 1, "name": "task 1", "description": "do the dishes"}
```
### Toggle Todo Done
- #### PUT: /todo
- ```javascript
{ "todoId": 1 }
```
### Delete Todo
- #### DELETE: /todo
- ```javascript
{ "todoId": 1 }
```
### Get User
- #### GET: /user### Delete User
- #### DELETE: /user## Authentication
Upon successful login, a JWT will be issued and stored in a secure cookie. This cookie will be sent with each request to authenticate the user.## Acknowledgments
- [Spring Boot Documentation](https://spring.io/projects/spring-boot)
- [JWT.io](https://jwt.io/)
- [mySQL](https://www.mysql.com/)