Skip to the page

Web platform · 16 concepts

Networking and HTTP for frontend

Know what really happens between fetch() and the server: connections, HTTP semantics, caching, real-time and reliable requests.

Asked in these mock interviews

Part 1 · 3 concepts

From URL to bytes

  1. 01

    What happens when you type a URL and press Enter

    The browser parses the URL, checks caches (HSTS, service worker, HTTP cache), resolves DNS, opens a connection (TCP + TLS or QUIC), sends the HTTP request, follows…

  2. 02

    DNS, TCP and TLS 1.3: round trips and connection reuse

    Before the first byte, a new connection costs a DNS lookup, a TCP handshake and a TLS handshake (TLS 1.3: one round trip), and TCP slow start limits how much data the…

  3. 03

    HTTP/1.1 vs HTTP/2 vs HTTP/3 (QUIC)

    HTTP/1.1 sends one request at a time per connection (browsers open about 6 per origin), HTTP/2 multiplexes many streams on one TCP connection with header compression…

Part 2 · 5 concepts

HTTP semantics, caching and delivery

  1. 04

    HTTP methods, safety, idempotency and idempotency keys

    GET and HEAD are safe (read-only); GET, HEAD, PUT, DELETE and OPTIONS are idempotent (repeating them has the same intended effect); POST and PATCH are not, so payments…

  2. 05

    Status codes and handling HTTP errors with fetch

    Status codes tell the client what happened (2xx success, 3xx redirect or not-modified, 4xx the client's fault, 5xx the server's fault), and fetch only rejects on…

  3. 06

    HTTP caching in depth: freshness, validation and Vary

    A cached response is reused without asking the server while it is fresh (max-age, s-maxage), then revalidated with ETag/If-None-Match or Last-Modified/If-Modified-Since…

  4. 07

    Compression: gzip, Brotli, zstd and dictionaries

    Text responses (HTML, CSS, JS, JSON, SVG) should be compressed with Brotli or zstd (gzip as fallback), chosen through Accept-Encoding and announced with…

  5. 08

    CDNs, cache keys and edge computing

    A CDN serves cached responses from servers close to users and shields your origin, and you control it through cache keys (URL, selected headers), lifetimes (s-maxage…

Part 3 · 2 concepts

API styles and pagination

  1. 09

    REST vs GraphQL vs tRPC vs gRPC-web, and the BFF

    REST exposes resources at URLs and works naturally with HTTP caching, GraphQL lets the client ask for exactly the fields it needs from one endpoint at the cost of…

  2. 10

    Pagination: offset, cursor and keyset

    Offset pagination (page=3) is simple and allows jumping to a page but gets slow and shows duplicates or gaps when data changes, while cursor (keyset) pagination asks…

Part 4 · 2 concepts

Real-time communication

  1. 11

    Polling, long polling, SSE, WebSockets and WebTransport

    Short polling asks repeatedly, long polling holds each request open until there is news, Server-Sent Events stream server-to-client text over plain HTTP with automatic…

  2. 12

    Keeping real-time connections reliable: reconnect, heartbeats, ordering

    Real connections drop all the time on mobile, so a production client reconnects with exponential backoff and jitter, detects dead connections with heartbeats, resumes…

Part 5 · 4 concepts

Reliable requests

  1. 13

    Timeouts, cancellation and race conditions with AbortController

    fetch has no default timeout, so you pass an AbortSignal: AbortSignal.timeout(ms) for a deadline, an AbortController to cancel when the user moves on, and…

  2. 14

    Retries with exponential backoff, Retry-After and limits

    Retry only failures that are likely temporary (network errors, 408, 429, 500, 502, 503, 504), only for idempotent requests or ones with an idempotency key, with…

  3. 15

    Request de-duplication and client-side caching (stale-while-revalidate)

    When several components need the same data at the same time, share one in-flight promise per key instead of firing duplicate requests, and keep results in a client…

  4. 16

    Offline support: service worker lifecycle and caching strategies

    A service worker is a script that sits between your pages and the network, so it can cache the app shell and answer requests offline using strategies like cache-first…

Your first interview is free

Sign up and start with a 15-minute interview with the full report, and an English conversation. No card needed.

Start your free interview