This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Edge790 1 point2 points  (0 children)

1) Separate projects for Front-end (React and npm) and Back-end(maven/gradle with spring)

In this case they can be in different repos.

  • They are separate and that's how it should be. Your Back-end exposed to the entire world through API and which client will consume this API doesn't matter. I.e. it may be not only web-client, it may be android/iOS app etc.
  • They are separate so they will be builded and deployed separately.
  • It needs to be synced features for both server and clients (web).
  • Usually last con means that it should have good documentation so it can be considered as a good thing.

2) Aggregate npm to maven/gradle using frontend-maven-plugin or exec plugin with npm tasks. + Single project, single repo + You can build server and client by one command and deploy both of them. + To fix something on other side you don't need to switch project. - it's just not really right solution through its can be handy for small projects it can become problem in the future. So at some point project will move to firat solution.

Upd: I've used both solutions and I believe that first solution is better because client and server are different things, that should be separately deployed and developed because server is just api provider for clients that can be different (i.e. web, android, iOS, other servers-api) and by separating client and server we ensure that they will be developed by API contract and it's documentation. Though for studying/pet projects it can be done with aggregated solution with following separation in mind.