Core Module
12 min forge

Client-Server Architecture

Master the most fundamental distributed architecture. Learn how browsers and apps interact with centralized data centers.

πŸ’» Client-Server Architecture

This is the foundational model of the internet. One or more clients request services from a centralized server that provides them.

πŸ’‘ The Logic (ELI5)

The Client (The Customer)

Think of a Guest at a restaurant.

  • You want something (Data/Page).
  • You don't know how to cook (Process Data).
  • You ask the waiter (Request).

The Server (The Kitchen)

Think of the Kitchen Staff.

  • You have all the ingredients (Database).
  • You know how to cook (Business Logic).
  • You provide the meal to the guest (Response).

πŸ” The Deep Dive

Request-Response Cycle

  1. Client: "Hey google.com, what are your search results for 'Cats'?"
  2. Network: The request travels over the internet.
  3. Server: Checks its database, builds the page.
  4. Client: Receives the data and renders the page using its own CPU/GPU.

Types of Clients

  • Thin Client: The server does almost all the work. The client just displays the result (e.g., a simple HTML page).
  • Thick Client: The client is more powerful. It downloads a large app (like a React app or a game) and does a lot of processing locally, only talking to the server for data.

🎯 Interview Pulse

Peer-to-Peer (P2P) Comparison

Interviewers might ask: "Is the internet always client-server?" Answer: No. In P2P (like BitTorrent or Blockchain), every computer is both a client and a server. There is no central authority.

Key Concepts

  • Statelessness: The server shouldn't have to remember who you are between requests (using Tokens instead).
  • Concurrency: How many clients can a server talk to at the exact same time?
  • Security: The "Server" is the trusted area. You must never trust data coming from the "Client." 🏒