Search code examples
single-page-applicationbackendweb-frameworksweb-frontend

Web Frameworks in combination with Single Page Applications


My experience in web apps, consists exclusively of frontend single page application frameworks/libraries (knockout/angular/react). I haven't released anything yet, or developed a back end - I have used mock data in the front end and essentially mocked the existence of a backend.

When developing single page apps with frameworks/libraries (eg Angular/React), since you can effectively provide an optimal user experience with routing taken care of, all on the front end (which means the back end will perform less tasks), is there any benefit to using a web framework, instead of just developing a web service API in a native language which is not enhanced by a web framework?

In my case, I am using React for the frontend and will use Elixir for the backend, and if I used a web framework for the backend it would be Phoenix (although specific technologies used are not important to this question, as specific technologies can be swapped out).

I feel like all my backend would be doing is fetching data from the database and inserting it into the database. Possibly a naive view due to not having done any backend.


Solution

  • You actually don't need a full-stack web framework (i.e. template handling or component framework). But still there are certain things you should consider:

    • Transaction management when writing to DB
    • Logging, log aggregation, zipping etc
    • Serving static files - namely your front-end
    • Serving HTTP REST calls in a convinient way
    • Caching (if any)
    • Binding these things together
    • Scaling/clustering
    • Authentication/session handling
    • Data validation
    • Error handling

    Frameworks usually allow you to address these things easily and let you focus on your business requirements.