Side by side
FrontendvsBackend
What is the difference between frontend and backend?
Updated 3 min read7 differences
In short
The frontend runs on the user's device and draws the interface, while the backend runs on servers and holds the data and rules the frontend relies on.
Frontend
The frontend is the part of an application that runs in front of the user, usually in the browser, drawing the interface and responding to clicks and typing.
Read the page on FrontendBackend
The backend is the server side of an application: the code, databases and services that store data, apply business rules and answer the frontend's requests.
Read the page on BackendFrontend and Backend compared
| Aspect | Frontend | Backend |
|---|---|---|
| Where it runs | On the user's device, in a browser or an app | On servers the user never sees |
| Main job | Drawing the interface and reacting to the user | Storing data, applying rules and answering requests |
| Typical languages | HTML, CSS, JavaScript and TypeScript | JavaScript, Python, Java, Go, C#, PHP and others |
| Can it be trusted? | No: users can change anything that runs on their device | Yes: it is where rules and permissions are enforced |
| Talks to | The backend, through APIs | Databases, caches, queues and other services |
| Main concerns | Usability, accessibility and page speed | Correctness, security, scaling and data integrity |
| Typical tools | React, Vue, Svelte and CSS frameworks | Web frameworks, databases and message queues |
The difference, explained
The frontend is everything the user sees and touches: pages, buttons, forms and animations, built with HTML, CSS and JavaScript or a mobile toolkit, and run on the user's own device. The backend runs on servers the user never sees: it stores data in databases, checks who may do what, applies the business rules and talks to other services.
The two meet at an API. When you press Buy, the frontend sends a request, usually over HTTP with JSON, and the backend checks the stock, takes the payment, saves the order and answers. The frontend can never be fully trusted, because users can change anything that runs on their device, so validation that matters, prices and permissions always have to be enforced on the backend too.
The line isn't always sharp. Server-side rendering runs frontend code on a server, frameworks such as Next.js mix both in one project, and a backend for frontend is a thin server layer made for one interface. A developer who works on both is called full-stack; larger teams usually split the roles, because each side has its own depth: browsers, accessibility and page speed on one side, data, scaling and security on the other.
A restaurant is a good picture. The frontend is the dining room, with the menu, the tables and the waiter taking orders; the backend is the kitchen and the storeroom, where the food is made and the stock is kept. Diners never enter the kitchen, and the kitchen doesn't decide how the tables are laid.
Which one should you use?
Choose Frontend when…
- The work is about what people see, click and read on the screen.
- You are improving layout, accessibility, animations or how fast pages feel.
- You enjoy visual work and seeing the result in the browser right away.
Choose Backend when…
- The work is about data, business rules, payments or permissions.
- Several apps, such as a website and a mobile app, need the same data and logic.
- You enjoy designing systems, databases and APIs that many clients rely on.
Both ends of one request
// Frontend: runs in the browser, asks the backend
const res = await fetch("/api/orders", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ productId: 42, quantity: 1 }),
});
showMessage(res.ok ? "Order placed" : "Something went wrong");// Backend: runs on the server, checks and saves
app.post("/api/orders", async (req, res) => {
const user = await requireLogin(req); // never trust the client
const order = await placeOrder(user, req.body); // checks stock, takes payment
res.status(201).json(order);
});Readers ask
Which is easier to learn, frontend or backend?
Neither is easier overall. Frontend gives quick visual feedback, which many beginners like, but browsers, layout and accessibility have real depth. Backend has less visual polish to worry about but more to learn about data, security and running servers.
What does a full-stack developer do?
A full-stack developer works on both sides: the interface and the server code, often including the database. In practice most full-stack developers are stronger on one side and comfortable enough on the other.
Is the database part of the backend?
Yes. The database is usually counted as part of the backend, because only server code talks to it; the frontend reaches the data through the backend's API.