This Spring Boot application serves as a backend for managing tasks. Users can create, update, and delete tasks after registering or logging in. Authentication is enforced through the use of an access token, which must be included in the Authorization header for creating, updating, or deleting tasks.
- User Registration: New users can register to access the task operations (Create, Update, Delete).
- User Authentication: Existing users can log in using their credentials.
- Task Operations: Authenticated users can create, update, and delete tasks.
- Access Token: Users must include a valid authentication access token in the Authorization header for secure task operations.
- Java 17
- Spring Boot
- Spring AOP (Aspect Oriented Programming) for Logging
- Spring Data JPA
- Spring Security Token-Based Authentication
- MySQL Database
- Swagger Documentation
- Clone the repository.
- Configure database settings.
- Build and run the Spring Boot application.
- Register as a new user or log in with existing credentials.
- Obtain an access token and include it in the Authorization header for task operations.
- Register a new user:
POST /api/v1/todo/auth/register
- Log in:
POST /api/v1/todo/auth/login
- Create a task:
POST /api/v1/todo/task
- Update a task:
PUT /api/v1/todo/task/{taskId}
- Delete a task:
DELETE /api/v1/todo/task/{taskId}
- Retrieve All Tasks With Specific Status as Query Parameter:
- For completed tasks:
GET /api/v1/todo/task?status=COMPLETED
- For in-completed tasks:
GET /api/v1/todo/task?status=IN_COMPLETED
- For completed tasks:
- Add Existing Task for User:
PUT /api/v1/todo/task/{taskId}/user/{userId}
To install the project, follow these steps:
- Open MySQL Workbench
- Create a new schema called
todo
- Clone the repository to your local machine:
git clone https://github.com/youssefGamalMohamed/todo-app-spring-boot.git
- Navigate to the project directory:
cd todo-app-spring-boot
- Open your favorite IDE for the project
- Build the
home
profile - Run the project
To simplify the setup and execution of the application, you can use Docker Compose. Follow these steps:
-
Ensure Docker and Docker Compose are installed: Make sure Docker and Docker Compose are installed on your machine. You can download them from the Docker website if you haven't already.
-
Clone the repository: If you haven't cloned the repository yet, do so with the following command:
git clone https://github.com/youssefGamalMohamed/todo-app-spring-boot.git
Navigate to the project directory:
cd todo-app-spring-boot
-
Configure Docker Compose: Ensure that your
docker-compose.yml
file is correctly configured. An exampledocker-compose.yml
might look like this:version: '3.8' services: mysql: image: mysql:5.7 container_name: mysql environment: MYSQL_ROOT_PASSWORD: root MYSQL_DATABASE: todo MYSQL_USER: user MYSQL_PASSWORD: password ports: - "3306:3306" networks: - todo-network app: image: openjdk:17-jdk container_name: todo-app depends_on: - mysql volumes: - .:/app working_dir: /app command: ./mvnw spring-boot:run ports: - "8080:8080" networks: - todo-network networks: todo-network: driver: bridge
-
Build and run the containers: Use Docker Compose to build and run the application:
docker-compose up --build
-
Access the application: Once the containers are up and running, you can access the Spring Boot application at
http://localhost:8080
. The MySQL database will be accessible on port3306
. -
Stopping the containers: To stop the running containers, use:
docker-compose down
This setup will help you run the application in a containerized environment, simplifying development and deployment.
- Download the Postman Collection from here