Giter Club home page Giter Club logo

tzesh / springboottemplate Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 0.0 241 KB

Spring Boot Template for RESTful API that uses JWT for authentication and authorization, PostgreSQL for database, Hibernate for ORM, and Lombok for boilerplate code generation and MapStruct for mapping DTOs to entities and vice versa

License: GNU General Public License v3.0

Java 100.00%
hibernate-jpa jwt-bearer-authentication lombok mapstruct postgresql refresh-token restful-api spring-boot template

springboottemplate's Introduction

Spring Boot Template

Description

A template for Spring Boot projects. This template includes the following features:

  • Spring Boot 3.0.6
  • Spring Security with JWT authentication and authorization also with refresh token
  • Swagger UI for API documentation and testing (http://localhost:8080/api/v1/swagger-ui/index.html) with authentication and authorization support
  • Spring Data JPA with PostgreSQL database integration
  • Exception handling mechanism with custom exceptions and exception handlers using @ControllerAdvice
  • Base entity and base DTO for common fields
  • Base service for common business logic
  • Custom @PreAuthorize annotation for authorization
  • Lombok for reducing boilerplate code
  • MapStruct for mapping DTOs to entities and vice versa

How to run

  1. Clone this repository
  2. Create a PostgreSQL database
  3. Change the database configuration in application.properties
  4. Run the application with mvn spring-boot:run
  5. Open http://localhost:8080/api/v1/swagger-ui/index.html in your browser
  6. Register a new user
  7. Login with the registered user
  8. Copy the JWT token from the response
  9. Click the Authorize button in the Swagger UI
  10. Paste the JWT token in the Value field without the Bearer prefix
  11. Click the Authorize button
  12. Now you can test the API endpoints
  13. To test the refresh token endpoint, click the Authorize button again and paste the refresh token in the Value field without the Bearer prefix

Maven Run Swagger UI

Contribute to this project

If you want to contribute to this project, please create a pull request.

springboottemplate's People

Contributors

tzesh avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.