Skip to content

Frontend and backend — where the code runs and how they talk to each other

Client, server, database and the API between them

When you use a web application there are actually two programs at work. Frontend is what runs in your browser and is what you see and click on. Backend runs on a server somewhere else and handles data rules and access. The two communicate over the internet.

§Frontend — the client side

Frontend consists of the HTML, CSS and JavaScript the browser fetches and runs. Here lies the user interface and the immediate interaction. Because the code runs at the user, you cannot rely on it for security — everything that comes from the client must be checked again on the server.

§Backend — the Server Side

Backend Handles Business Logic, Access Control and Data. This is Where You Typically Work With a Database, Validate Input, Check if the User is Allowed to Perform an Action, and Ensure Data is Saved and Retrieved Safely. Backend Runs on a Server that the User Does Not Have Direct Access To.

§The API between

Frontend and backend communicate through an API (Application Programming Interface). A common style is a web API, where frontend sends a request and backend responds with data — often in JSON format. That way, both a website, a mobile app and other systems can use the same backend, because they speak the same agreed language.

  • 01Frontend: user interface, runs in browser, cannot be trusted for security
  • 02Backend: Logic and Data, Runs on the Server, Validates Everything
  • 03API: the agreed contract for how they exchange data
  • 04Database: where data is stored persistently, accessed from the backend

§A typical data flow

Imagine a user saving a profile: the frontend collects the fields and sends them to the backend's API. The backend checks that the user is logged in and has permission, validates the fields, saves them in the database and responds with a result. The frontend then shows a confirmation. Each part does exactly its part of the work.