Building complete web applications: how a request travels through the stack, how login works, and how pages get rendered. Press play on any sketch to watch it happen.
1 Front end, back end, database
A full-stack developer works on every layer of a web app. The front end runs in the browser, the back end holds the rules and secrets, and the database keeps the data.
Front end: HTML for structure, CSS for style, JavaScript for behaviour. Frameworks include React and Svelte.
Back end: an API built with Node, Python, Java or similar.
Database: stores data permanently, for example PostgreSQL.
Validate on the server: browser checks help users, but anyone can bypass them.
// front end
const res = await fetch('/api/orders');
const orders = await res.json();
// back end
app.get('/api/orders', async (req, res) => {
const rows = await db.query('SELECT * FROM orders WHERE user_id = $1', [req.user.id]);
res.json(rows);
});
Sequence diagram
1/4 JavaScript in the browser asks the API for orders.
Rule of thumb: Never trust the browser. Treat everything it sends as untrusted input.
2 Login and sessions
Authentication proves who you are, and authorisation decides what you may do. Passwords are never stored directly: you store a slow hash, then compare hashes when someone logs in.
Hashing: use bcrypt or Argon2, which are built to be slow to attack.
Session cookie: the server remembers you, and the browser holds an ID.
JWT: a signed token that carries the user's details. Hard to revoke early.
Cookie flags: HttpOnly, Secure and SameSite block common attacks.
Data flow diagram
1/5 You send your email and password, always over HTTPS.
Rule of thumb: Use a well-tested auth library. Writing your own is one of the riskiest things you can do.
3 Rendering: where HTML is made
A page can be built in the browser, on the server for each request, or ahead of time. The choice affects speed, search ranking and cost. This site is built ahead of time.
CSR: client-side rendering. The browser gets JavaScript and builds the page itself.
SSR: server-side rendering. The server builds fresh HTML for each request.
SSG: static generation. HTML is built once, at deploy time.
Hydration: JavaScript wakes up server-made HTML to make it interactive.
Comparison
1/4 At deploy time, the build runs every page once and saves plain HTML.
Method
Best for
Main cost
CSR
Apps behind a login
Slow first load
SSR
Personal, changing pages
Server work per request
SSG
Docs, blogs, this site
Rebuild to change content
Rule of thumb: Use static pages if the content is the same for everyone. They are the fastest and the cheapest.