So the scenario is we are going to develop a web app. It will primarily consist of:

  • API
  • Front End stuff (HTML/CSS/JS)

I am considering two approaches:

  1. Package API separately into a *.war and deploy on the server. Write front end stuff and call those API. (This is what my previous company followed as we had API in hibernate ORM over RESTeasy deployed on JBOSS)

  2. Package all the API and UI stuff into a *.jar. This is what my current company is following. Spring Framework, JSP.

As I understand it, using the first approach we can have more modularisation. We can point our UI to whatever API URL which can come in handy while testing, switching APIs and so on. Using second approach we can maintain higher level of integrity as in making the UI code more secure and uniform as we can reference them directly from API code. Although the catch is that the code becomes little unreadable and messy, thought that could be just a personal opinion.

What are other reasons behind taking these kind of approaches? Is my understanding correct? What approach is suitable in what scenarios?


A lot depends on the type of system you are building and the set of requirements. If you tend to take up new requirements frequently or there is continuous feedback from the user to enhance your system then it becomes necessary to keep your architect as modular as possible. Now depending on your client requirements may be the second approach is what needed and more suitable for some set of requirements and specific to that client.

In case if you are building a generic system to serve multiple clients and need to modify the end product based on client request or if your solution is going to be provided as a platform or bridge between client's system and your backend solution then also it's recommended to use the 1st approach.

In short its very subjective to requirement.

One more major factor you can consider here is what trend your current company is following. Since that will help to re-use a lot of code base and less of rebuilding everything from scratch.

  • true.. specially the last statement.. no reinventing the wheel.. reusing is the way to go – Sudip Bhandari May 11 '17 at 10:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.