spring-boot-starter icon indicating copy to clipboard operation
spring-boot-starter copied to clipboard

A highly opinionated and complete template for Spring Boot projects ready for production

Spring Boot Starter

A highly opinionated and complete starter for Spring Boot production ready projects.

Running Instance on Heroku

https://spring-boot-starter.herokuapp.com/

Java CI with Gradle pre-commit

Built With

Features

  • DataTables with Spring Data JPA
  • OpenApi3 Swagger
  • Form Validation
  • Last Successful Login
  • New Relic Integration
  • Bruteforce Attack Prevention using Failed Login Attempts
  • Unit and Integration Tests
  • API Login Controller
  • Advanced CORS Configuration
  • Fully Covered Equals, HashCode, ToString Testing
  • Amazon S3 Implementation
  • Local AmazonS3 Integration Tests with S3Mock
  • Production Ready Folder Structure
  • Authentication and Authorization with JWT
  • Email Service with HTML and attachment support
  • Security Configuration Without WebSecurityConfigurerAdapter

Sample ongoing project using this template

Entity Relational Diagram (ERD)

img.png

Production Ready Folder Structure

.
|-- documents
|-- gradle
|   `-- wrapper
`-- src
    |-- integration
    |   |-- java
    |   |   `-- com
    |   |       `-- developersboard
    |   |           |-- backend
    |   |           `-- web
    |   `-- resources
    |-- main
    |   |-- java
    |   |   `-- com
    |   |       `-- developersboard
    |   |           |-- annotation  # All custom annotations used in the application
    |   |           |-- backend     # Business Logic and Data Access implementation
    |   |           |-- config      # Configuration classes and properties
    |   |           |-- constant    # Constants used in the application
    |   |           |-- enums       # Enums used in the application
    |   |           |-- exception   # Custom exceptions used in the application
    |   |           |-- shared      # Resources like dto, utils, etc. used in the application
    |   |           `-- web         # Web layer implementation
    |   `-- resources
    |       `-- i18n                # I18n property files, comes with 'en', 'fr', 'es' and 'zn_CN'
    `-- test
        |-- java
        |   `-- com
        |       `-- developersboard
        |           |-- backend
        |           `-- web
        `-- resources

Configuration properties required to deploy to Heroku:

img.png

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Credit

TBD

Authors

  • Eric Opoku - Initial work
  • George Anguah - Initial work
  • Matthew Puentes - Initial work
  • Stephen Boakye - Contributor
  • Charles Dimbeng - Contributor
  • Simon Kodua - Contributor

Acknowledgments

  • To Support
  • To learn
  • etc

Notes

  • The following environment variables can be customized as necessary.:
  • The defaults are:

      ADMIN_USERNAME=admin
      ADMIN_PASSWORD=password
      ENCRYPTION_SECRET_SALT=salt
      ENCRYPTION_SECRET_PASSWORD=password
      JWT_SECRET=salt
      SPRING_PROFILES_ACTIVE=dev
    
  • The AWS Properties and defaults are:

      AWS_REGION=us-east-1
      AWS_ACCESS_KEY_ID=AKIAIOSFODNN7EXAMPLE
      AWS_SECRET_ACCESS_KEY=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
      AWS_S3_BUCKET_NAME=spring-boot-starter
    
  • The Email Properties and defaults are:

      EMAIL_PROTOCOL=smtp
      EMAIL_HOST=smtp.gmail.com
      EMAIL_PORT=587
      EMAIL_USERNAME
      EMAIL_PASSWORD # If using gmail, this must be a 2 step verification enabled app password
    
  • Default profile for the application is dev, test and prod to test out production functionalities.
    • Datasource must be provided for production profile for the application to run.

NB: Windows users must use gradlew instead of ./gradlew

  • Start Spring Boot application using on linux/unix - ./gradlew bootRun
  • Run unit tests using - ./gradlew test
  • Run integration tests using - ./gradlew integrationTest
  • Run all tests using - ./gradlew testAll
    • Access application on http://localhost:8080/
  • Access in-memory database on http://localhost:8080/console
  • Run owasp dependency check - ./gradlew dependencyCheckAnalyze --info
  • Access Swagger UI - http://localhost:8080/swagger-ui/index.html

Running on Docker (Assuming docker is installed)

  • in the directory where docker-compose.yml file resides, simply run the command - docker-compose up

Stop running application on Docker

  • in the directory where docker-compose.yml file resides, simply run the command - docker-compose down