← Back to context

Comment by BrandoElFollito

8 hours ago

SSR (Server Side Rendering) provides the browser with a page that is created on the server (and possibly enhanced/hydrated on the client).

Having a separate backed and frontend allows for separation of duties: the client is responsible for the user-facing content and the backend deals exclusively with data flows. This allows to have several independent clients, machine to machine connections etc.

Whatever arrives to the server is untrusted, and the API (or other interfaces) only verify raw data (a JSON for instance) and there are excellent (backend) frameworks for that.

Mixing the visual content with the data is possible (Django does that for instance) but from a security perspective less efficient (again - separation of duties). It also requires to possible double the work to have an independent API.

In other words, if you separate the two you do not care about security on the front at all, and the one who builds the back can focus on their expertise.