FSD Frontend System Design

Chapter 1 · Networking

Revision sheet

Every lesson's idea and recap on one page. Read it before an interview, or print it.

  1. 1.1Important Guidelines

    Watch, then redraw the diagram from memory, then build it — three passes or it does not stick.

    • Watch → redraw → build. Skipping step 2 is why lessons don't stick.
    • Depth on one chapter beats coverage of five.
    • The diagram is the deliverable, not the notes.
  2. 1.2Why Networking Matters

    Most of a page load is waiting, not computing — so most of your wins live in the network.

    • Page loads are dominated by waiting, and waiting is round trips.
    • Latency hurts more than bandwidth on real networks.
    • Fix order: fewer round trips → closer bytes → fewer bytes.
  3. 1.3How the Web Works

    URL → DNS → TCP → TLS → HTTP → parse → render: six hops, each with a cache in front of it.

    • Six stages: URL, DNS, TCP, TLS, HTTP, render.
    • Every stage has a cache; the earliest hit is the cheapest.
    • The frontend's job is shortening the critical path, not the total byte count.
  4. 1.4Communication Protocols

    HTTP/1.1 queues, HTTP/2 multiplexes over one TCP stream, HTTP/3 removes TCP's shared queue entirely.

    • 1.1 queues per connection, 2 multiplexes per connection, 3 multiplexes per stream.
    • Head-of-line blocking moves down the stack with each version, then disappears.
    • Your bundling strategy must match your protocol version.
  5. 1.5REST APIs

    Nouns as URLs, verbs as methods, state in the response — and every call stands alone.

    • URLs are nouns; methods are the verbs.
    • Idempotency decides whether a client may retry.
    • Free HTTP caching is REST's biggest advantage — and over-fetching is its biggest cost.
  6. 1.6GraphQL

    One endpoint, one round trip, and the client declares exactly which fields it needs.

    • Client declares the shape; server resolves it in one round trip.
    • Over-fetching and round trips go away; caching and query governance arrive.
    • Say "N+1" and "persisted queries" — that's the senior signal.
  7. 1.7gRPC

    Binary contracts over HTTP/2 — call a remote function like a local one, in a fraction of the bytes.

    • Contract-first, binary, HTTP/2, streaming built in.
    • ~4× smaller payloads and generated types on both ends.
    • Lives behind your BFF, not in the browser.
  8. 1.8Choosing: REST vs GraphQL vs gRPC

    Pick by who the clients are and how nested the data is — not by what's newest.

    • Client type first, data shape second, caching third, volume fourth.
    • These are layers, not rivals — most real systems run all three.
    • Naming the trade-off you accepted matters more than the choice itself.

Capstone

Draw the full network path for loading an Instagram post, with every cache hit marked.