Video summary

3. What is a Backend, how do they work and why do we need them?

Main summary

Key takeaways

Technology

Concise summary

This is a tutorial-style explainer showing what a backend is, how an HTTP request travels end‑to‑end, and why backends are required rather than moving server logic into frontends.

Definition and high-level role

Backend (server): a computer listening on open ports (HTTP/HTTPS, WebSocket, gRPC, etc.) that serves content (static files, JSON) and accepts/persists client data. Its core responsibility is handling data — fetch, receive, persist, and act on it.

Key responsibilities:

  • Serve content (static files, JSON APIs).
  • Receive and persist client data.
  • Execute server-side application logic and coordinate with databases and other services.

End-to-end request flow (demo)

  1. Browser issues a request for a domain/subdomain.
  2. DNS resolves the domain via A / CNAME records to a public IP.
  3. The request reaches the cloud instance (demo uses AWS EC2).
  4. AWS security groups (firewall) must allow the relevant ports (commonly 80, 443, and 22 for SSH); otherwise the request is blocked.
  5. Nginx (reverse proxy) on the instance receives the request and:
    • handles redirects (e.g., 80 → 443),
    • uses certbot to provision SSL certificates,
    • proxies traffic to local ports (for example: backend on localhost:3001, frontend on localhost:3000).
  6. A process manager (pm2) runs the Node.js processes that actually serve responses.
  7. The Node server returns the response to Nginx, which forwards it back to the client (browser).

Frontend (browser) flow and contrasts

  • Demo uses a Next.js app served by the same EC2 instance + Nginx proxy.
  • Typical browser flow:
    • Fetch an HTML document.
    • Request JS/CSS/fonts/images referenced by that HTML.
    • Once JS loads, it “hydrates” and sets up event listeners.
  • Key difference:
    • Frontend code is downloaded and executed by the browser (client-side runtime).
    • Backend code executes on the server.

Why we need a backend (examples and responsibilities)

  • Centralized state and data persistence:
    • Example: an Instagram “like” — the client sends a request; the server authenticates the user, writes the like to a database, and triggers downstream actions such as notifications.
  • Centralization is required so each client does not have to hold global application state or run logic that affects other users.
  • Additional backend responsibilities include authentication, authorization, validation, aggregation, and coordinating with databases and external services.

Why backend logic can’t simply run in the browser

  • Security / sandboxing: browsers isolate code for user safety and restrict access to the file system and environment.
  • CORS restrictions: browsers block cross-origin requests unless servers provide proper CORS headers.
  • Database access and drivers: server runtimes have native DB drivers (Postgres, MongoDB) that handle sockets, binary data, and efficient query/connection pooling; browsers cannot safely or efficiently do this.
  • Connection pooling & scale: backends maintain pooled persistent DB connections to handle thousands of requests; having each client open DB connections would overwhelm the database.
  • Client compute limits: user devices vary (phones, low-spec machines); offloading heavy business logic to clients leads to poor UX. Servers can be scaled vertically/horizontally to handle load.

Tools and technologies shown or referenced

  • AWS EC2 (public IPs)
  • DNS A / CNAME records
  • AWS security groups (firewall rules)
  • Nginx (reverse proxy)
  • certbot (automatic SSL certificate provisioning)
  • pm2 (process manager)
  • Node.js server (backend)
  • Next.js (frontend)
  • Browser devtools / network panel

Meta / tutorial notes

  • The video demonstrates request/response traces in the browser network tab and in the AWS console.
  • Presenter mentions future videos covering request/response mechanics and CORS in more depth.

Main speaker / source

  • An unnamed presenter (single tutorial speaker) demonstrating and explaining the architecture and concepts. Primary tools shown: AWS (EC2, security groups), Nginx, certbot, pm2, Node.js, and Next.js.

Rate this summary

Your feedback will help improve summaries.

Improve this summary

Reprocess with a stronger model when the summary feels incomplete or inaccurate.

Pro

Translate summary in another language

Pro

Ask questions to this video

Chat for follow-up questions, clarifications, and source-backed answers.

Coming soon

Share this summary

Original video