Boilerplate JAVA 17 SpringBoot - A boilerplate for Spring Boot with JWT authentication, email functionalities, and much more. ๐โญโก
Boilerplate JAVA 17 SpringBoot is a Spring Boot boilerplate that provides a solid foundation for building web applications with JWT authentication, CORS filters, email functionalities, and more. It comes with a set of features and configurations more fast as possible your development. I will commit some improvements over time here and I will also create a boilerplate in Kotlin as the next objective, if possible send improvements to this project, I will insert crud abstraction here too and in Kotlin crud it will also be something very similar to this โก๐โญ
- JWT authentication
- CORS filter configuration
- Token provider and JWT authentication filter
- User roles with permissions
- Email functionalities (account creation, email verification, login, password reset, password forget)
- Example controller, service, repository, entity, and domain
- Exception handling
- Seeder for initial user creation with example permissions
- Lombok for simplified mapping and reduced boilerplate code
- Dockerfile for containerization
- Docker Compose for easy database setup
- Supports Java 17 and Spring Boot 2.5
Before you begin, ensure you have met the following requirements:
- Java 17
- Docker (for database containerization)
- SMTP server credentials for email setup (optional)
-
Clone the repository:
git clone https://github.com/jhonatanaraujo1/java-springboot-boilerplate.git
-
Navigate to the project directory:
cd exemple.backend
-
Build the project:
mvn clean install
-
Execute Docker-compose:
docker-compose up
-
Just Run :
mvn spring-boot:run
The configuration for the project can be found in the application.properties file. Update the necessary properties, such as database connection details and SMTP server credentials, as per your requirements.
The application provides several API endpoints for authentication, user management, and example functionalities.
The project includes an example controller (ExampleController.java) that demonstrates the usage of JWT authentication and basic CRUD operations.
The seeder (SeedEventListner.java) is responsible for creating initial users with example permissions. Modify it to suit your needs.
The project includes a robust exception handling mechanism. Custom exceptions are thrown and handled appropriately to provide meaningful responses.
The project uses various libraries to enhance functionality and simplify development. Key libraries include:
- Spring Boot
- Lombok
- Mapstruct
- Spring Security
- JWT
- Hibernate
- Thymeleaf
- and more...
The project includes an example mapper (ExampleMapper.java) that uses Mapstruct and Lombok for simplified mapping between entities and DTOs.
The Dockerfile (Dockerfile) is included for containerization. Build and run the Docker image to deploy the application in a containerized environment.
To enable email functionalities, provide the necessary SMTP server credentials in the application.properties file. Two example server configurations are provided, choose one based on your requirements.
Unfortunately, the test for this section did not pass โ, but it is crucial for all projects. I'll do it later.
๐จ Monitoring is Essential!
While the monitoring setup is currently not in place (โ), I recognize its importance in ensuring the health and performance of the application. Rest assured, I'll be working on implementing a robust monitoring solution to keep track of key metrics, identify issues promptly, and ensure a smooth user experience.
๐ Continuous Integration/Continuous Deployment (CI/CD) Coming Soon ๐จ
I acknowledge the absence of CI/CD setup (โ) at the moment, but I want you to know that it's high on my priority list. Implementing CI/CD pipelines is crucial for automating the testing and deployment processes, ensuring code quality, and delivering updates seamlessly. Stay tuned for upcoming improvements in this area!
If you find this project helpful or valuable, consider giving it a star! โญ Also, follow me on LinkedIn for updates and more.
If you encounter any bugs, please feel free to reach out by sending a message or creating a pull request.โก๐