HCDD 411: Client-Server Architecture

Md Touhidul Islam

Today's Goals:

  • Understand How modern systems are built
  • Understand the client-server model
  • Explore each component one by one
  • See how everything works together

The Big Picture: Evolution of Computing

To understand where we are, let's see how we got here...

1970s-1980s: Standalone Computers

💻

Single Computer

Everything stored locally. No sharing. No internet.

1990s-2000s: Networks & The Web Emerges

💻 ↔️ 💻 ↔️ 💻

Connected Computers

Computers connected via networks. Early websites. Dial-up internet.

Today: Distributed Systems

📱 💻 🖥️ ↔️ ☁️ ↔️ 🗄️🗄️🗄️

Millions of Devices & Servers

This is what we'll study! Systems split across many computers, working together seamlessly.

Key Insight: Modern applications don't run on a single computer. They're distributed across many computers, each with a specific role. This is called a distributed system.

The Client-Server Model

The most common way to organize a distributed system is the client-server architecture. It divides responsibilities into two main roles:

CLIENT

📱

The Requester

Your device: phone, laptop, browser

SERVER

🖥️

The Provider

Powerful computer storing data and running services

Real-World Analogy: Restaurant 🍽️

You (The Client):

  • Look at the menu
  • Order your food
  • Wait to receive it
  • Enjoy your meal

Kitchen (The Server):

  • Has all the ingredients
  • Receives your order
  • Prepares the food
  • Sends it back to you

Core Principle: The client requests, the server responds. Simple as that!

Three Essential Components

No matter how complex an application is, it always has these three parts:

📱

CLIENT

What users see and interact with

🌐

NETWORK

The pathway for communication

🖥️

SERVER

Where data and logic live

Real Example: Checking Instagram

  • Client: Instagram app on your phone
  • Network: WiFi or cellular data connection
  • Server: Instagram's computers storing all the photos and user data

Remember: We'll explore each of these components in detail, one at a time. First, let's understand what each one does...

Component 1: The Client (Front-End)

What Users See and Touch

📱 💻 🖥️

The Client = Any Device You Use

What Does the Client Do?

  • Displays information to users (text, images, videos)
  • Accepts user input (clicks, typing, touches)
  • Sends requests to the server when it needs data
  • Receives responses from the server and shows them

Examples of Clients

  • Web browsers (Chrome, Safari, Firefox)
  • Mobile apps (Instagram, Gmail, Twitter)
  • Desktop applications
  • Smart TV apps

Technologies We'll Learn

  • HTML: Structure of web pages
  • CSS: Styling and layout
  • JavaScript: Interactivity
  • React: Building modern interfaces

Component 2: The Network

The Highway for Data

🌐 🛜 📡

The Network = The Connection Between Client and Server

What Does the Network Do?

  • Transmits requests from client to server
  • Carries responses from server back to client
  • Uses protocols (rules) to ensure data arrives correctly
  • Handles millions of messages simultaneously
📱

Your Phone

WiFi or Cellular

Internet

🖥️

Web Server

The Protocol: HTTP/HTTPS

Just like humans speak different languages (English, Spanish, French), computers use protocols to communicate.

HTTP (HyperText Transfer Protocol) is the language of the web. It defines:

  • How to format requests and responses
  • What different types of requests mean (GET, POST, etc.)
  • How to handle errors

Component 3: The Server (Back-End)

The Brain and Memory of the System

🖥️ 🗄️ ⚙️

The Server = Where Everything Important Happens

What Does the Server Do?

  • Stores all your data (photos, messages, user accounts)
  • Processes requests (searches, calculations, updates)
  • Manages business logic (rules like "you must be logged in")
  • Sends back responses to clients
  • Handles thousands of users at the same time

Server Components

  • Web Server: Handles incoming requests
  • Application Logic: Processes data
  • Database: Stores information permanently

Technologies We'll Learn

  • Node.js: Runs JavaScript on the server
  • Express: Framework for building web servers
  • MongoDB: Database for storing data

Why Servers? Imagine if Instagram stored all your photos on your phone. You'd run out of space instantly! Servers have:

  • Massive storage capacity
  • Powerful processors
  • Always-on availability
  • Security and backups

How It All Works Together

Let's watch what happens when you check social media...

Step 1: User Action

You open Instagram and pull to refresh your feed

(This happens on the CLIENT - your phone)

Step 2: Client Sends Request

App creates a message: "Give me the latest posts"

(Sent through the NETWORK using HTTP)

Step 3: Request Travels

Message travels through WiFi → Internet → Instagram's servers

(Happens in milliseconds!)

Step 4: Server Processes

Instagram's server:

  • Checks who you are (authentication)
  • Looks up who you follow
  • Finds their recent posts from the database
  • Prepares them in a nice format

Step 5: Server Sends Response

Server packages the posts and sends them back

(Travels back through the NETWORK)

Step 6: Client Displays

Instagram app receives the data and displays it beautifully on your screen

(CLIENT renders the UI)

This entire cycle happens in less than a second! And it repeats every time you interact with any web application.

Advanced Concepts

Static vs Dynamic Content

📄 Static Content

What it is: Fixed content that never changes

Example: A company's "About Us" page

Example Page

About Our Company

We were founded in 2010.

We have 50 employees.

Our office is in New York.

This text is written directly in HTML and doesn't change unless a developer manually updates it.

Uses: Simple websites, documentation, blogs

⚡ Dynamic Content

What it is: Content that changes based on data or user actions

Example: Your personalized Instagram feed

Example Page

Welcome back, Sarah!

You have 5 new messages.

Today is Sunday, January 11, 2026

Current temperature: 72°F

The name, message count, date, and temperature all change based on data from the server!

Uses: Social media, email, online shopping, dashboards

The Difference:

  • Static: HTML creates the page once, shows the same thing to everyone
  • Dynamic: Server generates different HTML for each user based on data

Databases: The Memory of Your Application

Every application needs to remember things. That's where databases come in!

What Gets Stored in a Database?

  • User accounts and profiles
  • Posts, photos, videos
  • Messages and comments
  • Product catalogs
  • Order history
  • Settings and preferences
  • Everything that needs to persist!

Example: Viewing Your Social Media Posts

1. You click "My Profile" button → Client sends request

2. Request reaches server → "Show posts for user Sarah123"

3. Server asks database → "Find all posts where user = Sarah123"

4. Database returns → 10 posts with photos, captions, dates

5. Server formats data → Organizes posts newest to oldest

6. Client displays posts → You see your beautiful photos!

Building Sophisticated User Interfaces

Traditional Approach: HTML + JavaScript

How it works:

  • Write HTML for structure
  • Write JavaScript to update parts of the page
  • Manually keep everything in sync

Modern Approach: React

How it works:

  • Describe what the UI should look like
  • React automatically updates everything
  • Never worry about keeping things in sync!

Why React? In a real app, you might show the same data in 50 different places. React automatically keeps all 50 places updated when the data changes. Traditional JavaScript requires updating all 50 manually - easy to make mistakes!

What is an Application Programming Interface (API)?

An API is like a menu at a restaurant - it tells you what you can request and how to request it!

📋 🔌 🤝

API = The Contract Between Client and Server

What Does an API Do?

  • Defines what requests the server can handle
  • Specifies how to format those requests
  • Describes what responses you'll get back
  • Hides the complex server code - you just need to know how to ask!

Restaurant Menu Analogy 🍽️

Menu (API):

  • "Burger - $10"
  • "Pizza - $15"
  • "Salad - $8"

You don't need to know:

  • How to cook it
  • Where ingredients come from
  • Kitchen equipment used

You just need to know: What to order and how much it costs!

Web API Example 💻

Weather API:

  • "Get weather for New York"
  • "Get 5-day forecast"
  • "Get current temperature"

You don't need to know:

  • How weather data is collected
  • Database structure
  • Server programming language

You just need to know: What URL to call and what format to expect!

📱

Your App

"I need weather data"

Uses the Weather API

"GET /weather?city=NewYork"

🖥️

Weather Server

"Here's the data: 72°F, Sunny"

REST APIs

REST (Representational State Transfer) is a set of simple rules for designing web services. Think of it as a menu for your server!

Core Idea: Everything is a Resource

In REST, everything (users, posts, products) is treated as a resource with its own unique address (URL).

Example: Blog Posts API

GET /api/posts

→ Get a list of all blog posts

GET /api/posts/42

→ Get the specific post with ID 42

POST /api/posts

→ Create a new blog post

Send data: title, content, author

PUT /api/posts/42

→ Update post 42

Send new data: updated title or content

DELETE /api/posts/42

→ Delete post 42

Why This Matters: REST makes APIs predictable! If you know one REST API, you can guess how others work. It's like knowing that in every restaurant, you order from a menu and pay at the end - consistent patterns make life easier!

Putting It All Together

CLIENT

📱

React

User Interface

HTML/CSS/JS

Structure & Style

NETWORK

🌐

HTTP/HTTPS

Communication Protocol

REST API

Structured Requests

SERVER

🖥️

Node.js

JavaScript Runtime

Express

Web Framework

MongoDB

Database

Slide 1 of 15