During this weekend I read "Get Your Hands Dirty on Clean Architecture" by Tom Hombergs. I am working on a microservice that was born with Hexagonal Architecture in mind, so I was able to recognize a lot of patterns already; anyway, I am still a bit unsure of the role that a Spring Application would play in such architecture.
My microservice is composed of a Spring Reactive web application exposing a GraphQL interface, a relational database, and a third-party REST API client.
I get that the GraphQL interface itself should map to an input adapter, where the GraphQL resolvers would then call the input port implementations in order to interact with the domain. Since I'm using Spring Boot and DGS Framework to handle GraphQL queries and mutations, the GraphQL adapter module will certainly contain the GraphQL resolvers.
As said, I am not sure what to do exactly with the Spring Boot Application itself, which will basically spin up the HTTP Server, host a health check REST controller and the authentication logic for the GraphQL endpoint, the GraphiQL UI, and the aforementioned health check controller. Currently it is in the same module that contains the GraphQL adapter, but my instinct tells me that it should be kept in a separate module, because of the "compositing" role it has in regard to the various port implementations; also, keeping it merged with the web app with the GraphQL adapter would mean making it aware of the other adapters, because the web app would need to also access them, so it goes against the separation of concerns.
On the other hand, keeping them separated makes me wonder how should I approach the GraphQL adapter tests: currently, I have some tests that make a POST call to the GraphQL server and assert against the content of the response, but since the GraphQL adapter shouldn't know anything about the HTTP layer, I think having to spin up an HTTP test server is leaking unnecessary details about the presence of the HTTP server.
So, to summarize my post: is it correct to have the web app application in a separate module from the GraphQL adapter, or they should live close to each other?
I hope what I wrote makes at least a little sense. Of course, feel free to ask any detail that could be useful to the discussion.
so it goes against the separation of concerns.why does it matter to you? Forget dogmas... Is there a business motivation that prevents you from implementing one or another solution? Does one approach seem better aligned with your organization's way to work and operate? Do you find one solution to be best for non-technical reasons?