{"id":14982996,"url":"https://github.com/gtiwari333/spring-boot-web-application-sample","last_synced_at":"2025-05-16T00:06:50.359Z","repository":{"id":38364166,"uuid":"186284368","full_name":"gtiwari333/spring-boot-web-application-sample","owner":"gtiwari333","description":"Real World Spring Boot Web Application Example with tons of ready to use features","archived":false,"fork":false,"pushed_at":"2025-03-08T22:59:06.000Z","size":1841,"stargazers_count":345,"open_issues_count":1,"forks_count":128,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-04-08T11:11:12.358Z","etag":null,"topics":["archunit","gatling","java","java-web","jms","keycloak","mapstruct","seed-project","selenide","selenium","skeleton-application","spock","spring","spring-boot","spring-mvc","spring-security","thymeleaf","webjars"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gtiwari333.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-05-12T17:31:07.000Z","updated_at":"2025-04-04T04:11:09.000Z","dependencies_parsed_at":"2024-06-08T18:22:37.535Z","dependency_job_id":"21f6525a-61c6-49b3-8547-8b74420214e6","html_url":"https://github.com/gtiwari333/spring-boot-web-application-sample","commit_stats":{"total_commits":344,"total_committers":4,"mean_commits":86.0,"dds":0.07267441860465118,"last_synced_commit":"ded60bca7c52134731c9c03b54aa12364f804b30"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gtiwari333%2Fspring-boot-web-application-sample","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gtiwari333%2Fspring-boot-web-application-sample/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gtiwari333%2Fspring-boot-web-application-sample/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gtiwari333%2Fspring-boot-web-application-sample/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gtiwari333","download_url":"https://codeload.github.com/gtiwari333/spring-boot-web-application-sample/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254442854,"owners_count":22071878,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["archunit","gatling","java","java-web","jms","keycloak","mapstruct","seed-project","selenide","selenium","skeleton-application","spock","spring","spring-boot","spring-mvc","spring-security","thymeleaf","webjars"],"created_at":"2024-09-24T14:06:33.259Z","updated_at":"2025-05-16T00:06:45.351Z","avatar_url":"https://github.com/gtiwari333.png","language":"Java","readme":"### A Spring Boot Web Application Sample with tons of ready-to-use features. This can be used as starter for bigger projects.\n\n#### Variations\n- Simpler version without KeyCloak and multi-modules is on separate project https://github.com/gtiwari333/spring-boot-blog-app\n- Microservice example that uses Spring Cloud features(discovery, gateway, config server etc) is on separate project https://github.com/gtiwari333/spring-boot-microservice-example-java\n\n\n### App Architecture:\n[![Foo](https://lucid.app/publicSegments/view/8c2fa859-36bd-4559-80c7-12fb30997092/image.png)](https://lucid.app/documents/view/fa076c6e-86d3-412b-a9bc-1996dca86a1e)\n#### Included Features/Samples\n\nMicroService:\n\n[//]: # (- Spring micrometer based tracing with zipkin)\n- Exposing and implementing Open Feign clients\n- Spring Cloud Contract (WIP)\n\nSpring MVC:\n- Public and internal pages\n- MVC with thymeleaf templating\n- Live update of thymeleaf templates for local development\n- HTML fragments, reusable pagination component using Thymeleaf parameterized fragments\n- webjar - bootstrap4 + jquery\n- Custom Error page\n- Request logger filter\n- Swagger API Docs with UI  ( http://localhost:8081/swagger-ui.html)\n- @RestControllerAdvice, @ControllerAdvice demo\n- CRUD UI + File upload/download\n- favicon handler\n\nSecurity:\n- Account management with KeyCloak\n- Spring Security \n- User/User_Authority entity and repository/services\n    - login, logout, home pages based on user role\n- Domain object Access security check on update/delete using custom PermissionEvaluator\n- private pages based on user roles\n- public home page -- view all notes by all \n- Limit max number of record in a paged request\n\nPersistence/Search:\n- Data JPA with User/Authority/Note/ReceivedFile entities, example of EntityGraph\n- MySQL or any other SQL db can be configured for prod/docker etc profiles\n- (in old code) H2 db for local, Console enabled for local ( http://localhost:8081/h2-console/, db url: jdbc:h2:mem:testdb, username: sa)\n- jOOQ integration with code generation based on JPA entity \n- Liquibase database migration\n\nTest:\n- Unit/integration with JUnit 5, Mockito and Spring Test\n- Tests with Spock Framework (Groovy 4, Spock 2)\n- e2e with Selenide, fixtures. default data generated using Spring\n- Load test with Gatling/Scala\n- Architecture tests using ArchUnit\n- file upload/download e2e test with Selenide\n- TestContainers to perform realistic integration test\n- Reset DB and Cache between test\n- Assert expected query count during integration test\n\nMisc:\n- Code Generation: lombok,  mapstruct \n- Message Queue using ActiveMQ Artemis\n- Approval/flagging api - message based\n- Nested comment\n- Cache implemented\n- Zipkin tracing \n- Websocket implemented to show article/comment review status/notifications..\n\nFuture: do more stuff\n- CQRS with event store/streaming  \n- Spring Cloud Contract integration (WIP)\n- Docker-compose deploy/kubernetes \n- Visitors log - IP, browser, etc\n- Centralized error reporting\n- Geo-Spatial query for visitors\n- Grafana Dashboard, @Timed and more ...\n- logback LevelChangePropagator integration\n- logback error email\n- logback rolling policy\n- Integrate Markdown editor for writing notes\n- rate limit by IP on public API ( article api )\n- Fetch user's avatar\n- UI improvement\n- S3 file upload, test with localstack TestContainers\n- nested comment query/performance fix \n- Signup UI\n- vendor neutral security with OIDC\n- JfrUnit ( WIP )\n- \n### Requirements\n- JDK 17+\n- Lombok configured on IDE\n    - http://ganeshtiwaridotcomdotnp.blogspot.com/2016/03/configuring-lombok-on-intellij.html\n    - For eclipse, download the lombok jar, run it, and point to eclipse installation\n- Maven\n- Docker \n  - Make sure docker is started and running\n  - Run `$ sudo chmod 666 /var/run/docker.sock` if you get error like this \"Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? (Details: [13] Permission denied)\"\n\n#### How to Run\n\nIt contains following applications:\n\n- main-app\n- email-service (optional)\n- report-service (optional)\n- trend-service (optional)\n- content-checker (optional)\n\n# Note you will need to create a database named 'seedapp' in your mysql server\n\nOption 1 - run with manually started  KeyCloak, ActiveMQ and MySQL  servers\n- Run ```mvn clean install``` at root \n- Run ```docker-compose -f config/docker-compose.yml up``` at root to start docker containers\n- Go to main-app folder and run ```mvn``` to start the application\n\nOption 2 - automatically start KeyCloak, ActiveMQ and MySQL using TestContainer while application is starting\n- Run ```mvn clean install``` at root \n- Go to main-app folder and run ```mvn -Pdev,withTestContainer``` to start the application\n\nOption 3 - run from IDE\n- import into your IDE and compile the full project and run the Application.java on main-app module\n- Update run configuration to run maven goal `wro4j:run` Before Launch. It should be after 'Build'\n\n\n## Run Tests (use ./mvnw instead of mvn if you want to use maven wrapper)\n\n## It uses TestContainers, which requires Docker to be installed locally.\n\n##### Running full tests\n\n`mvn clean verify`\n\n##### Running unit tests only (it uses maven surefire plugin)\n\n`mvn  compiler:testCompile resources:testResources  surefire:test`\n\n##### Running integration tests only (it uses maven-failsafe-plugin)\n\n`mvn  compiler:testCompile resources:testResources  failsafe:integration-test`\n\n## Code Quality\n\n##### The `error-prone` runs at compile time.\n\n##### The `modernizer` `checkstyle` and `spotbugs` plugin are run as part of maven `test-compile` lifecycle phase. use `mvn spotbugs:gui' to\n\n##### SonarQube scan\n\nRun sonarqube server using docker\n`docker run -e SONAR_ES_BOOTSTRAP_CHECKS_DISABLE=true -p 9000:9000 sonarqube:latest`\n\nPerform scan:\n`mvn sonar:sonar`\nmvn sonar:sonar -Dsonar.login=admin -Dsonar.password=admin\n\nView Reports in SonarQube web ui:\n\n- visit http://localhost:9000\n- default login and password are `admin`, you will be asked to change password after logging in with default\n  username/password\n- (optional) change sonarqube admin password without logging\n  in: `curl -u admin:admin -X POST \"http://localhost:9000/api/users/change_password?login=admin\u0026previousPassword=admin\u0026password=NEW_PASSWORD\"`\n- if you change the password, make sure the update `-Dsonar.password=admin` when you run sonarqube next time\n\n### Dependency vulnerability scan\n\nOwasp dependency check plugin is configured. Run `mvn dependency-check:check` to run scan and\nopen `dependency-check-report.html` from target to see the report.\n\n\n## Run Tests Faster by using parallel maven build\n`mvn -T 5 clean package`\n\n\nOnce the application starts, open  `http://localhost:8081` on your browser. The default username/passwords are listed on : gt.app.Application.initData, which are:\n\n- system/pass\n- user1/pass\n- user2/pass\n\n\n#### Screenshots:\n\n#### Public View\n![](screenshots/public-page.png)\n\n#### Read Article with nested comment/discussion\n![](screenshots/read-article-with-nested-comment.png)\n\n#### Logged in Feed View\n![](screenshots/logged-in-home-page.png)\n\n#### Logged in User's Article List View\n![](screenshots/users-home-page.png)\n\n#### Admin User's Review Page to approve/disapprove flagged posts\n![](screenshots/admin-user-review-page.png)\n\n#### Review Page\n![](screenshots/review-flagged-content.png)\n\n#### New Article\n![](screenshots/new-article-page.png)\n\n\n#### Dependency/plugin version checker\n - `mvn versions:display-dependency-updates`\n - `mvn versions:display-plugin-updates`\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgtiwari333%2Fspring-boot-web-application-sample","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgtiwari333%2Fspring-boot-web-application-sample","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgtiwari333%2Fspring-boot-web-application-sample/lists"}