Why frontend and backend exist as separate things

Published on 2026-09-12 by frfrand

Frontend and backend are not just a division of tasks: they run in different environments. What goes on each side, where to validate, and why you shouldn't trust the browser.

Why frontend and backend exist as separate things

Short answer: frontend and backend are separated because they run in opposite environments. The frontend runs in someone else's browser, which can read it, modify it, or bypass it; the backend runs on your server. That's why business rules, permissions, and secrets always go in the backend, and validating on the frontend is just a courtesy.

Many people hear "frontend and backend" and understand it as a division of labor: some do the visual part and others do the logic. It's true as a role description, but it falls short and leads to wrong decisions.

The real separation is deeper: they are two environments with incompatible properties.

The difference that explains everything

The frontend runs on someone else's machine.

That's it. Everything else follows from there.

The code you send to the browser is in the user's hands: they can read it, modify it, run it manually, or simply ignore it and send requests with another tool. There's no way to prevent it, because for it to work, the browser needs to understand what you sent it.

The backend runs on your server, where you control who enters and what gets executed.

That's why anything that has to be true must be decided in the backend.

The practical consequence

A recurring example: a form that validates that the age is greater than 18. It's validated on the frontend so the user gets the warning instantly, without waiting for the server. Perfect.

And you also have to validate it on the backend. Not out of distrust towards that user: because the request can arrive without going through your form.

The short rule: validating on the frontend is a courtesy, validating on the backend is the rule.

The same goes for prices, permissions, stock, and discounts. If the browser sends "price: 0", the server has to ignore that data and look up the real price.

What lives on each side

Frontend: visual structure, styles, interactions, immediate validations, interface state, animations.

Backend: business rules, permissions, database access, integrations with external services, secrets.

That last word deserves emphasis. API keys, database credentials, and tokens for paid services cannot be on the frontend. Not even "obfuscated": everything that reaches the browser is visible.

The boundary between the two: the API

The conversation goes through an explicit interface, normally HTTP with JSON.

That clear boundary is what allows the same backend to serve a website, a mobile app, and an automated process. And it allows the frontend team to redesign everything without touching the business logic.

It's also where it's worth being strict: the API should accept exactly what it needs and reject the rest, with clear error messages. A permissive API is comfortable the first month and a source of bugs forever.

When the separation gets in the way

It's worth saying, because the industry sometimes exaggerates. For a content site, separating into a frontend that consumes an API can be extra work without benefit: the server returns HTML already built and ready.

The separation pays for itself when there are several interfaces against the same backend, when the teams are different, or when the interface is very interactive. For a blog, no.

Where each thing lives on a server

In practice, both end up on the same machine more often than you might think: nginx serves the frontend's static files and, when the route starts with /api, it passes the request to the backend listening on a local port.

In ArduMaker this distribution is configured from the panel: a repository can be deployed as a static site and another as a service, each with its own domain or subdomain, on the same VPS or on different ones. If you prefer to serve both under the same domain, with /api pointing to the backend, that rule is added manually to the nginx server block of that domain.

Publish frontend and backend separately

A React SPA can be compiled into static files, and a FastAPI API needs a process that keeps running. On an ArduMaker VPS you can host both pieces and use Nginx to route app.dominio.com to the frontend files and api.dominio.com to the API.

The browser should only receive public variables. PostgreSQL passwords and private keys belong to the backend, not to the JavaScript package.

Related: What is an API · What is CORS.

Frequently asked questions

Is frontend validation enough? No. Any request can reach the server without going through your form, so the validation that matters is the backend's. Frontend validation is useful to quickly notify the user.

Where do API keys go? In the backend, in environment variables or in a secrets manager. Everything that reaches the browser is visible, even if obfuscated.

Is it always worth separating frontend and backend? No. For a content site, having the server return built HTML is usually simpler. Separation pays off with multiple interfaces against the same backend, different teams, or highly interactive interfaces.

  • frontend
  • backend
  • arquitectura
  • web
  • ArduMaker

Keep reading

All articles · VPS plans