In my company we had a debate about this this and most of my colleagues were leaning towards API based design. Every action should have an API and should be completely decoupled from UI. What do you guys think - which one makes more sense?
In general, the API driven architecture is much better, but the correct approach depends on the project to be implemented. The following factors have to be taken in consideration to evaluate the correct structure:
Scalability: How big will the application be and if it will it be accessed by multiple types of devices.
Budget: For example, a simple web portal which has very limited budgetary restraints and no short term growing forecast I see no reason to have an API.
I don't see so much benefits, only one on a first view, the possibility to extend you app after, for example, you can create a Android App that consumes your API, or, maybe another people can create their websites that consumes your API too.
as always it depends :D
In generell I would say the API approach is better, espacially in the long run with different teams working on the frontend and backend with different technologies, approaches and speed. The only think they need to agree on is the API structure. So if this is defined both teams can start developing without the real implementation is done by using API mocks. And also the reusability of the API is great, consider mobile apps, open some resources of the API to the public, enable white label solutions and so on. Also you can change the backend technology completly without changed one line of the frontend, as long as the API interface stays the same.
But in the beginning if a project the setup of the CI process, choosing the rechnologies, preparing the structure, etc. pp. for both parts is more complex and time consuming then for monolithics. So if you phasing time pressure or just want to build a prototype you properbly faster with a traditional way of building the web app. Always consider refactor the project to a API approach later ;)
Marcus Pohorely
CTO/CEO @Pagelanes.com
We have switched everything to an API Driven Arch and will continue doing it in the future. It`s simply better without any doubt:
and much much more.