{"id":21901076,"url":"https://github.com/naspredam/rest-spring-boot-multi-project-hexagonal-architecture","last_synced_at":"2025-09-06T09:46:15.746Z","repository":{"id":263126676,"uuid":"327399947","full_name":"naspredam/rest-spring-boot-multi-project-hexagonal-architecture","owner":"naspredam","description":"Hexagonal architecture with DDD and multi project gradle approach","archived":false,"fork":false,"pushed_at":"2021-01-06T18:45:32.000Z","size":202,"stargazers_count":9,"open_issues_count":0,"forks_count":9,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-07-19T19:32:39.397Z","etag":null,"topics":["clean-architecture","gradle","hexagonal-architecture","java","multiproject","rest","spring-boot"],"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/naspredam.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":"2021-01-06T18:40:22.000Z","updated_at":"2025-06-22T22:01:21.000Z","dependencies_parsed_at":"2024-11-20T11:04:29.432Z","dependency_job_id":null,"html_url":"https://github.com/naspredam/rest-spring-boot-multi-project-hexagonal-architecture","commit_stats":null,"previous_names":["naspredam/rest-spring-boot-multi-project-hexagonal-architecture"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/naspredam/rest-spring-boot-multi-project-hexagonal-architecture","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/naspredam%2Frest-spring-boot-multi-project-hexagonal-architecture","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/naspredam%2Frest-spring-boot-multi-project-hexagonal-architecture/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/naspredam%2Frest-spring-boot-multi-project-hexagonal-architecture/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/naspredam%2Frest-spring-boot-multi-project-hexagonal-architecture/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/naspredam","download_url":"https://codeload.github.com/naspredam/rest-spring-boot-multi-project-hexagonal-architecture/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/naspredam%2Frest-spring-boot-multi-project-hexagonal-architecture/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273886640,"owners_count":25185509,"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","status":"online","status_checked_at":"2025-09-06T02:00:13.247Z","response_time":2576,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["clean-architecture","gradle","hexagonal-architecture","java","multiproject","rest","spring-boot"],"created_at":"2024-11-28T15:12:13.395Z","updated_at":"2025-09-06T09:46:15.655Z","avatar_url":"https://github.com/naspredam.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# rest-spring-boot-hexagonal-architecture\n\nThis project is to expose my interpretation of the hexagonal architecture, under spring-boot framework using gradle multi-project.\n\nThis approach seems a little more complex, but it has some advantages, as be able to limit the dependency packages per module. What I can see that this could be useful is on the case of having a monolith. On micro-services, as it is expected that the domain should be under a boundary context, this should not be a problem to have in a single project.\n\nThe diagram of the hexagonal architecture relies on the following:\n\n![Hexagonal architecture diagram](img/hexagonal-architecture.png)\n\nI have tried to take a diagram that I have seen common on different articles, even though I saw port/adapter to be swap.\n\nThis architecture follows the clean architecture from Uncle bob:\n\n[https://blog.cleancoder.com/uncle-bob/2012/08/13/the-clean-architecture.html](https://blog.cleancoder.com/uncle-bob/2012/08/13/the-clean-architecture.html)\n\nThis project is following this diagram on spring-boot framework.\n\n## Application diagrams\n\nOn this I was doing the following approach diagram:\n\n![Application diagram](img/hexagonal-arch-spring-naspredam.png)\n\nWhere we have as part of the application is:\n\n- REST implementation\n- Database connection\n\nThe colors meant to be:\n\n- Orange: this is the domain model of our application, that is located on `com.example.service.user.domain`\n- Blue: this is the application itself, where we have the logic and the ports (to apply this logic from and to). The package is: `com.example.service.user.application`\n- Green: this is the package `com.example.service.user.adapter`, where are the implementation of the ports. It was decided to keep the repositories and the controllers, even though this could be moved to the `infrastructure` package.\n\nWhat was not played out on this diagram was the package:\n\n`com.example.service.user.infrastructure`\n\nThis package is cross, so it was not having a flow on the diagram, but impacts to be defined shared components.\n\n## Domain model\n\nThe domain model is a simple one, for user management.\n\nThis diagram it is just a simple information for eventual `User` domain. We can see the following domain model diagram:\n\n![Domain model diagram](img/user%20domain%20model.png)\n\nwhere the colors here represents:\n\n- Orange: entity or root aggregate of our domain\n- Blue: value objects\n\nThis domain has a functions class, where it is a bunch of functions to access to `User` entity information.\n\n## Architecture tests\n\nIt was implemented the arch rules from [arch unit library](https://www.archunit.org/).\n\nThe tests are located on:\n\n```text\ncom.example.service.user.architecture.*\n```\n\n## Test strategy\n\nThe tests develop were doing unit tests for each class of the project.\n\nDo integration test on the controller, which is our application entry point.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnaspredam%2Frest-spring-boot-multi-project-hexagonal-architecture","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnaspredam%2Frest-spring-boot-multi-project-hexagonal-architecture","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnaspredam%2Frest-spring-boot-multi-project-hexagonal-architecture/lists"}