HTTP & the browser model
Request lifecycle, status codes, headers, caching (ETag, Cache-Control), cookies, CORS. Half of "the API is broken" bugs are a misread header.
The mental model
HTTP is a stateless order-form protocol: every request is a complete, self-describing envelope (method + URL + headers + optional body), and every response is a complete, self-describing reply (status + headers + optional body). The server is a clerk with amnesia — it remembers nothing between envelopes. Everything that feels like memory (logins, carts, sessions) is smuggled inside the envelopes themselves, mostly as cookies.
The analogy that sticks: a mail-order catalog company. The method is the type of form (GET = "send me the catalog page", POST = "place this order", PUT = "replace my address on file", DELETE = "cancel my subscription"). Status codes are the reply stamps: 2xx "done", 3xx "we moved, write to this address", 4xx "your form is wrong", 5xx "our warehouse is on fire". Caching headers are the clerk writing "this price list is valid until Friday — don't write to us again before then" on the reply.
Why statelessness exists: it is what makes the web horizontally scalable. Because any server can answer any request without shared in-memory state, you can put 200 identical servers behind a load balancer and lose 50 of them without users noticing. Break the model — say, by storing session state in one server's memory with no sticky routing — and requests start landing on servers that have never heard of the user. Half of "the API is broken" bugs in a fullstack team are really a misread header: a cache serving stale data, a cookie that never got sent cross-site, a CORS preflight that was never answered.
- Deep dive
- Internal architecture
- Real-world use cases
- Best practices
- Common mistakes
- Performance
- Security
- Production troubleshooting
- Advantages & disadvantages
- Alternatives
- Interview expectations
- Interview questions
- Facts to remember
- Cheat sheet
- Quick revision