The Anatomy of the Modern Web Stack: A Top-Down Architectural Map
The Anatomy of the Modern Web Stack: A Top-Down Architectural Map
A senior engineer joins a team where the repository is React on the front, Node.js in the middle, and PostgreSQL behind. They can read any single layer fluently. When production latency spikes from a p50 of 180ms to a p99 of 2,400ms, nobody on the team can say with confidence whether the regression lives in the CDN, the load balancer's connection draining, the application server's event loop saturation, or the new read replica's replication lag. The team is full of specialists. What it lacks is a unifying map. This chapter exists to draw that map.
The term "full-stack" has been quietly inflated over the last decade. In 2008 it meant Linux, Apache, MySQL, and PHP. In 2025 it encompasses edge runtimes, TLS termination strategies, HTTP/3 multiplexing, container orchestration, observability pipelines, vector databases, and AI inference gateways. A mental model that treats the stack as three horizontal stripes—frontend, backend, database—is no longer adequate for reasoning about cross-layer trade-offs, let alone for making defensible decisions about where a piece of logic should live. We need a more granular taxonomy, a precise description of the request lifecycle, and a vocabulary for discussing the movement of logic between layers. That is the work of this chapter.
The Full-Stack Problem Space in 2025
The first task is to bound the problem. A modern web application is not a single process running on a single machine. It is a distributed system whose components may live in dozens of geographic regions, run on hardware the application team does not own, and be configured by teams the application team has never met. The "full-stack engineer" of 2025 must reason about:
- **The network path** from a user's device through DNS resolvers, transit providers, and anycast routing.
- **The transport layer**, including TCP slow start, TLS 1.3's 1-RTT handshake (RFC 8446), and HTTP/3's QUIC-based multiplexing (RFC 9114).
- **The edge plane**, where CDNs terminate connections, run WAFs, and increasingly execute user code in V8 isolates or WASM runtimes.
- **The application plane**, where business logic, authentication, and request orchestration live, often behind a service mesh.
- **The persistence plane**, where relational stores, document stores, caches, queues, and search indices coexist, each with its own consistency model.
- **The infrastructure plane**, which today means Kubernetes, serverless platforms, or edge networks, not bare metal.
The reason a unified mental model is indispensable is not aesthetic. It is operational. When p99 latency regresses, the diagnostic path traverses every one of these layers in turn. Without a model, engineers guess. With a model, they form hypotheses, deploy instrumentation, and eliminate layers systematically. The chapters that follow this one each dig into a layer in detail. The work of this chapter is to assemble the whole picture so that the deep dives have a frame of reference.
A second reason matters. The architectural decisions that produce the greatest leverage are almost always cross-layer. Should personalization be computed at the edge, in the application server, or in the database? Should authentication state live in a JWT validated at the CDN, in a session cookie validated by the app, or in a token introspection call to an identity provider? Each option has different latency characteristics, different failure modes, and different security properties. None of these questions can be answered within a single layer's vocabulary.
A Taxonomy of Layers: From Edge to Persistence
Six layers organize the remainder of this book. The boundaries between them are not always sharp—HTTP/3 blurs the line between transport and application, and edge functions blur the line between edge and application—but the taxonomy is a useful first approximation.
1. The Edge Layer
The edge is the portion of the stack that runs as close to the user as possible, typically in CDN points of presence (POPs). Its responsibilities include:
- **Termination of TCP and TLS** at geographically distributed POPs.
- **Caching of static and dynamic assets**, with cache keys derived from URL, headers, and sometimes cookies.
- **Execution of edge functions**, such as Cloudflare Workers, Fastly Compute, or Deno Deploy, which run in lightweight isolates with startup times measured in milliseconds.
- **Security filtering**, including WAF rules, bot detection, and DDoS mitigation.
- **Request rewriting**, including redirects, header injection, and A/B test routing.
The edge is not a single product but a class of services. Its defining property is geographic distribution and proximity to end users. A request that hits a POP in Frankfurt instead of an origin in Virginia saves roughly 100ms of round-trip time on transatlantic links—a budget large enough to absorb an entire database round-trip.
2. The Presentation Layer
The presentation layer runs in the browser. In 2025 it includes:
- **HTML, CSS, and JavaScript**, executed by a layout engine (Blink, WebKit, Gecko).
- **Single-page application frameworks** such as React, Vue, Svelte, and Solid, which maintain a virtual DOM and reconcile state changes.
- **Server-side rendering frameworks** such as Next.js, Remix, SvelteKit, and Nuxt, which emit HTML on the server and hydrate it on the client.
- **WebAssembly modules** that execute compiled code—often C++, Rust, or Go—in a sandboxed runtime.
- **Browser-native APIs**, including the Web Audio API, WebGL, WebGPU, IndexedDB, and the File System Access API.
The presentation layer's latency budget is dominated by the critical rendering path: parse HTML, build the DOM, parse CSS, build the CSSOM, execute scripts, layout, paint, and composite. Chapter 2 examines this in detail. For the architectural map, the key insight is that the presentation layer is no longer a passive consumer of HTML. It is an active participant in the request lifecycle, capable of prefetching, prerendering, optimistic updates, and offline operation.
3. The Transport Layer
The transport layer carries bytes between peers. It includes:
- **TCP** (RFC 9293), with its three-way handshake, slow start, congestion avoidance, and fast retransmit algorithms.
- **TLS 1.2 and TLS 1.3**, providing confidentiality, integrity, and authentication. TLS 1.3's 1-RTT handshake and 0-RTT data mode (with replay risk) represent a significant latency win over TLS 1.2's 2-RTT handshake.
- **QUIC** (RFC 9000), the UDP-based transport underlying HTTP/3, which integrates TLS 1.3, eliminates head-of-line blocking at the stream level, and survives connection migration across IP changes.
- **HTTP/1.1, HTTP/2, and HTTP/3**, with their respective semantics for multiplexing, server push (deprecated in HTTP/2), and prioritization.
- **gRPC and Connect** for binary, schema-driven RPC over HTTP/2 or HTTP/3.
- **WebSockets and Server-Sent Events** for server-pushed real-time data.
The transport layer is often invisible to application developers until it isn't. A misconfigured TCP receive window, a missing HTTP/2 server push dependency, or a QUIC-capable client routed to a non-QUIC edge will each manifest as latency that no amount of application-layer optimization can recover.
4. The Application Layer
The application layer is where business logic lives. Its responsibilities include:
- **Request routing**, often implemented with reverse proxies (Envoy, nginx, Caddy) or service meshes (Istio, Linkerd).
- **Authentication and authorization**, typically using OAuth 2.0, OIDC, JWT validation, or session cookies.
- **Business logic**, expressed in a general-purpose language (TypeScript, Python, Go, Java, Rust).
- **Orchestration of downstream calls**, including database queries, cache lookups, and inter-service RPCs.
- **Serialization and deserialization** of request and response bodies, often using JSON, Protocol Buffers, or MessagePack