This repository provides a robust template for building RESTful APIs using Spring Boot. It includes essential features such as:
- JWT-based authentication and authorization
- PostgreSQL integration
- Flyway for database migrations
- Swagger/OpenAPI for API documentation
Open the application.properties file and set the following:
- Database URL, username, and password
- JWT key file paths (
app.key,app.pub)
Generate RSA key pair files for signing and verifying JWTs:
app.key: Private key (keep this secret)app.pub: Public key
⚠️ Do not commit these files to version control.
Start the Spring Boot application using your preferred method:
./mvnw spring-boot:runThis project uses PostgreSQL and Flyway for managing schema migrations.
sudo snap install flywayDownload and install from the Flyway official site.
Use the following command to apply migrations:
flyway -url=jdbc:postgresql://localhost:5432/spring_base \
-user=postgres \
-password=postgres \
-schemas=base \
-locations=filesystem:./flyway/db \
migrateSwagger UI is enabled for exploring and testing endpoints.
The interface allows you to authenticate using your JWT token and interact with secured endpoints directly.
Feel free to fork this repository and adapt it to your own project. PRs are welcome if you find improvements or bug fixes to share!
This project is open-source and available under the MIT License.