Thuta Learning
IntermediateWeb Developmentbeginner

Domain, DNS, Hosting, and CDN

What you'll walk away with

  • Explain the core ideas behind Domain, DNS, Hosting, and CDN
  • Read the diagram and trace how a request, piece of data, or event flows through the system
  • Explain how this piece connects into the larger web architecture picture

Build the mental model

A domain (example.com) is a human-readable address; a subdomain (learn.example.com) is a labeled subsection of it. The part like .com is the TLD. Owning a domain does not mean you have hosting.

A registrar is the company you buy and manage a domain through. Note that the registrar, DNS provider, and host can be separate companies.

DNS maps a domain name to a destination - keep the mental model domain -> DNS -> hosting. Record types (A, CNAME) exist, but their administration lives in Cloud & Deployment.

  • Static hosting - simple, unchanging files
  • Shared hosting - resources shared across many sites
  • VPS - your own virtual server
  • Cloud platform - scalable, managed infrastructure
  • Serverless - function-level, on-demand execution
  • Container - a packaged, portable environment
  • Managed platform - the hosting company handles the operations

A CDN caches content across many geographic locations and serves users from the nearest one, reducing latency and origin load.

Domain
A human-readable name (like example.com) used instead of a numeric address to identify a site on the internet.
DNS
The system that maps human-readable domain names to the addresses or destinations they should point to.
CDN
A distributed network of servers that caches content in multiple geographic locations to reduce latency and load on the origin server.
text
DOMAIN, DNS, HOSTING, AND CDN
-----------------------------
DOMAIN, DNS, HOSTING, AND CDN
-------------------------------

  learn.example.com
        |
        v
  [ DNS ]  -- resolves the name to an address
        |
        v
  [ Hosting / Origin Server ]

CDN EDGE CACHING
------------------

              +----------------+
              |  Origin Server |
              +----------------+
                      |
           distributes cached copies to edges
                      |
     ------------------------------------------
     |               |                        |
 [CDN: US East]  [CDN: Europe]           [CDN: Asia]
     |               |                        |
  User (near)     User (near)             User (near)

Connect it to a real scenario

A concrete flow: buy the domain, point DNS at hosting, serve static assets from a CDN, and send dynamic requests to the origin.

The code below looks at a request's description and decides which of DNS, CDN, or Origin Server would typically handle it.

Try the working example

javascript
function routeRequest(request) {
  if (request.isFirstDnsLookup) {
    return "DNS";
  }
  if (request.isStaticAsset) {
    return "CDN";
  }
  return "Origin Server";
}

const examples = [
  { label: "First visit, resolving learn.example.com", isFirstDnsLookup: true },
  { label: "Loading a cached logo.png", isStaticAsset: true },
  { label: "Fetching /api/dashboard for a logged-in user", isStaticAsset: false },
];

examples.forEach((ex) => {
  console.log(ex.label, "->", routeRequest(ex));
});
You should see
Logs three routing decisions: the first-visit lookup routes to 'DNS', the cached image routes to 'CDN', and the dashboard API call routes to 'Origin Server'.

5-minute try-it

Look up which company registered a domain you use, and separately check which company appears to be hosting or serving its static assets (a browser's network panel or a DNS lookup tool can reveal both).

One important caution

Assuming buying a domain automatically means a website is live somewhere - a domain is just a name, not hosting.

Treating registrar, DNS provider, and host as always being the same company - they often are for convenience, but architecturally they're separate roles.

Wikipedia - Domain Name SystemHow the Web Works

Easy traps

  • Assuming buying a domain automatically means a website is live somewhere - a domain is just a name, not hosting.
  • Treating registrar, DNS provider, and host as always being the same company - they often are for convenience, but architecturally they're separate roles.
  • This course is a system map, not a deep-dive on every piece -- for depth on REST, DNS/hosting, databases, or security, continue to the API Tutorial, Cloud & Deployment, SQL, or Cybersecurity tutorials.

Exercise

Look up which company registered a domain you use, and separately check which company appears to be hosting or serving its static assets (a browser's network panel or a DNS lookup tool can reveal both).

You'll know it worked when: Logs three routing decisions: the first-visit lookup routes to 'DNS', the cached image routes to 'CDN', and the dashboard API call routes to 'Origin Server'.

Domain, DNS, Hosting, and CDN | Thuta Learning