What Actually Happens When You Type a Domain Name: DNS, Nginx, Clusters, and CDN
Many developers can build an API but can't trace a request end-to-end through production infrastructure. This walkthrough connects DNS, reverse proxying, load balancing, static asset offloading, and CDN caching into one coherent chain — the minimum mental model needed to reason about a live system's bottlenecks, failure points, and cost drivers.
Typing a domain name triggers a chain that most developers learn in fragments. DNS resolves the name to an IP; a TCP (and possibly TLS) connection forms; an entry-point layer — typically Nginx or a cloud load balancer — receives the request and forwards it to one of many identical backend servers running the application. The backend queries a shared database for dynamic data, while static assets like images, JS, and CSS are served from a separate object store (OSS) and distributed through a CDN so users worldwide hit a nearby cache.
The article builds this path step by step, starting from a single-server Nest.js + MySQL setup and scaling it out. It clarifies why Nginx is a reverse proxy, not a business-logic server; why server clusters all run the same code against a shared database; and why avatar URLs often point to a different domain — because static files are stripped out of the application path entirely.
A three-layer mental model emerges: business data (MySQL), business logic (Nest.js), and network/infrastructure (DNS, Nginx, OSS, CDN). The final section ties it back to database design, showing why an `avatar` table stores only metadata while the actual bytes live in object storage and get delivered by CDN.
The article's strength is sequencing: it starts with a single-server mental model and adds each piece only when the previous setup breaks under scale, which mirrors how real architectures evolve.
Treating DNS, Nginx, OSS, and CDN as answers to six concrete questions ('Where should I go?', 'Who should handle this request?', 'Where are the actual files?') turns a fog of acronyms into a checklist a developer can debug against.
The three-layer split — data, logic, infrastructure — is a useful classification for onboarding: it prevents beginners from conflating Nginx config with business code or CDN caching with database queries.
The explicit connection back to database schema design (why an `avatar` table stores only metadata) closes a common gap between backend developers who design tables and those who operate deployment pipelines.