What a Backend Does
Part of the Web Development Roadmap
In short
The frontend can't be trusted with secrets, payments or other people's data, because anyone can open DevTools and change it. The backend is the trusted place where the real decisions are made.
The backend receives requests from the frontend, checks who is asking, applies business rules, reads and writes the database and sends back a response, usually as JSON.

Think of it like this
The bank counter
At a bank, you fill a slip at the front desk. You never walk into the vault yourself. The clerk checks your ID, checks your balance, applies the bank's rules, updates the ledger and hands you a receipt. Your app's frontend is the slip; the backend is the clerk; the database is the vault and ledger.
Watch it happen
Placing a food order
POST /orders { items, address }
1/6The app sends the order as JSON, along with the user's login cookie.
The big ideas
What you need to know
Receives requests
It listens for HTTP requests at routes like GET /products or POST /orders.
Checks and protects
Authentication, input validation and permission checks all happen here, where users can't tamper with them.
Applies business rules
Prices, discounts, stock and limits are calculated on the server so everyone gets the same correct result.
Talks to the database
It reads and writes data, then sends back a response, usually JSON with a status code.
How it works
The life of one request
- 1
Receive
The request arrives at a route with a method, URL, headers and body.
- 2
Authenticate
Check who is asking, usually from a cookie or token.
- 3
Validate
Make sure the input is complete and sensible.
- 4
Do the work
Apply rules and read or write the database.
- 5
Respond
Send JSON with the right status code: 200, 201, 400, 401, 404 or 500.
See it in code
Walk through the code
1import express from "express";2const app = express();3app.use(express.json());4 5const menu = { samosa: 20, chai: 15, vadapav: 25 }; // real prices live here6 7app.post("/orders", (req, res) => {8 const { items } = req.body; // e.g. [{ name: "samosa", qty: 2 }]9 10 if (!Array.isArray(items) || items.length === 0) {11 return res.status(400).json({ error: "Order needs at least one item" });12 }13 14 let total = 0;15 for (const item of items) {16 const price = menu[item.name];17 if (!price) return res.status(400).json({ error: "Unknown item: " + item.name });18 total = total + price * item.qty;19 }20 21 res.status(201).json({ message: "Order placed", total });22});23 24app.listen(3000, () => console.log("API on http://localhost:3000"));1/5Create the app and let it read JSON request bodies.
A tiny Express backend. A real one would also check the login and save to a database, which you'll add in the next phases.
Save yourself the pain
Common mistakes
Oops
Trusting prices or user roles sent from the frontend.
Do this instead
Anyone can edit requests in DevTools. Look up prices and permissions on the server every time.
Oops
Putting API keys or database passwords in frontend code.
Do this instead
Everything in the frontend is visible to users. Keep secrets on the backend in environment variables.
Your mission
Backend job list
Quick check
Why should the final order total be calculated on the backend?
Go deeper
- 1List what the backend must do when a user places an order on a food delivery app.
- 2Learn why prices and permissions must be checked on the server, not only in the browser.
- 3Watch the Network tab while using a web app and guess what each API call does on the server.
More topics at this stop
Stuck on this topic? Ask an Insider
Get 1:1 guidance from people who've walked this exact path — on the InsideEdge app.