I am wondering how best to slice up a Java Mustache web app which has:
- Data layer (JPA, Repos, Entities, etc)
- Service layer getting data from other company web services outside the package
- Web/Controller layer serving up Mustache template pages
Important to note this is all in the same Maven module (I know).
What I really dislike about this is that a lot of the Mustache logic is wrapped up with non-UI code, in case all the way to the Service layer.
What I am thinking of doing is extract all the Mustache logic together with all the controllers and Spring web security stuff into a new module called project-ui or similar.
Leave the Data and Service logic inside a project-api module.
At this point would you either
- Deploy project-api on its own and expose endpoints for all data? This seems a little over-engineered to me
- Add the API package as project-ui dependency and leave it to the UI controllers to retrieve the data?
Any clear way of doing this that I am not aware of? Ideally, I'd rather let a NodeJS/ReactJS app serve the UI layer but the decisions have already been made. Think big corp environment.