Skip to content

robotTX1/SpringTodoApp

Repository files navigation

Spring Todo Application

Tech Stack

Component Technology
Backend (REST) Spring 6 & SpringBoot 3.12 (Java 17)
Security Token Based (Spring Security and JWT )
REST Documentation Swagger & Spring Doc
REST Spec Open API Standard
Persistence JPA (Using Spring Data)
Build Tool Gradle

Features

Security Features

  • Registering new users
  • Login with existing user
  • Logout with one or all devices
  • Role System
  • Authentication and authorization with JWT
  • Refresh Token functionality
  • Forgot Password
  • Verify Email

Application Features

  • Create, Read, Update, Delete Todos
  • Filter and Sort Todos
  • Upload profile image for User

How to use this code?

  1. Make sure you have Java 17 and Gradle installed

  2. Clone this repository

$ git clone https://github.com/robotTX1/SpringTodoApp.git
  1. Navigate into the folder
$ cd SpringTodoApp
  1. Create secrets.yaml in your resources folder and copy everything from example-secrets.yaml to it. Change example values to real ones.

  2. Run generateRsaKeys.sh in your resources/certs folder to generate RSA private and public keys

  3. Build project

$ gradle build
  1. Run the project
$ gradle bootRun
  1. Navigate to http://localhost:8080/swagger-ui.html in your browser to check everything is working correctly. You can change the default port in the application.yml file
server:
  port: 8080
  1. Make a GET request to /api/v1/todos to check you're not authenticated. You should receive a response with a 401 with no message since you haven't set your valid JWT token yet
$ curl -X GET 'http://localhost:8080/api/v1/todos'
  1. Make a POST request to /api/v1/auth/login with the default admin user we programatically created to get a valid JWT token
$ curl -d '{"email": "[email protected]", "password": "password"}' -H 'Content-Type: application/json' -X POST 'http://localhost:8080/api/v1/auth/login'
  1. Add the JWT token as a Header parameter and make the initial GET request to /api/v1/todos again
$ curl -H 'Authorization: Bearer <JWT_TOKEN>' -X GET http://localhost:8080/api/v1/todos
  1. If you got 200 OK and your todos back thank you did everything correctly!

Contribution

  • Report issues
  • Open pull request with improvements
  • Reach out to me directly at [email protected]