Spring Boot template with core Spring JWT-based Security setup. The implementation includes access and refresh tokens. Template utilizes modern libraries and approaches to securing application.
Technologies used β’ Demo β’ How to use
Spring Boot β core backend framework.
Spring Security β authentication and authorization system.
Spring Data JPA + Hibernate β ORM and data persistence.
MySQL β relational database.
Flyway β data migration tool.
JJWT β jwt encoding and decoding.
Gradle β build automation tool.
Docker & Docker Compose β containerization and orchestration of Spring Boot app and MySQL instance.
- Have Docker installed on your local machine
- Clone the repository to your local machine
git clone https://github.com/antonio-backnotfront/security-jwt-template.git- Create .env file in the root folder (on the same level as build.gradle) following the structure specified in .env.example file:
security-jwt-template/
βββ .env.example
- Run docker compose
docker compose up --build- Access API endpoints under localhost:8080 and MySQL instance under localhost:3306.
- Authentication is performed via
/api/auth/loginand/api/auth/register.
- Access tokens are required for secured endpoints via the
Authorization: Bearer <token>header.
- To refresh tokens, use the
/api/auth/refreshendpoint with your refresh token insideAuthorization: Bearer <token>header.
Copyright (c) 2025 Anton Solianyk
