Marcell CD

Networking Fundamentals - The Layers That Power the Web

Networking Fundamentals - The Layers That Power the Web

For most developers, networking just work but do not really think or perhaps do not understand how it works under the hood, — you write fetch("https://api.example.com"), and somehow data appears. But under that simple call is a decades‑old engineering masterpiece involving multiple layers of abstraction.

Lets go through the basics of networking how your code actually “talks” to the web, it helps to break things down from the ground up — layer by layer.

The OSI Model: 7 Layers of Networking

The Open Systems Interconnection (OSI) model serves as a fundamental framework that outlines the process by which data and information are transmitted from one application to another across a network. This structured model is divided into seven distinct layers, each with its own specific responsibilities and functions. These layers range from the physical transmission of electrical signals to the intricate formatting of data, such as JSON responses, which are commonly used in modern web applications.

To gain a deeper understanding, let us explore each of these layers in more detail, providing relevant examples that developers encounter on a daily basis. This examination will highlight not only the critical functions of each layer but also the practical implications they have on the development and deployment of networked applications.


1. Physical Layer — The Hardware Base

This layer handles physical transmission — the cables, fiber optics, Wi‑Fi signals, and even the electrical impulses or light pulses that actually carry data.

Example: The Ethernet cable that connects your office router to a server rack — or the radio waves that link your laptop’s Wi‑Fi adapter.


Here data travels within the same local network. It bundles raw bits into frames with addresses (like a street name).

Example: A packet from your laptop to your home router uses MAC addresses on this layer before it ever reaches the internet.


3. Network Layer — The Routing Brain

The network layer’s job is to route packets between networks using IP addresses.

Example: When your computer requests data from a remote API, routers use IP addresses to decide how each packet travels across networks to reach that API server.


4. Transport Layer — The Package Manager

This layer manages end‑to‑end communication between systems. It decides how to send, verify, and reassemble data.

For instance:

// Using TCP (HTTP sits on top of it)
const response = await fetch("https://api.example.com/data")

Underneath, TCP ensures your request packets arrive and reassemble correctly.
Compare this to a live video stream (WebRTC), which often uses UDP to prioritize speed over guaranteed delivery.


5. Session Layer — Managing Conversations

The session layer maintains sessions — the continuous exchange of information between systems.


6. Presentation Layer — Data Translator

This layer translates, encrypts, or compresses data so that applications can understand it regardless of format or language.

Example: fetch() converts a streamed HTTPS response into JSON via this layer.


7. Application Layer — Where Developers Live

This is the top layer — what most developers directly use. It defines protocols and data formats that apps use to talk to each other.

Example: Every time you do an API call in your frontend, you’re building on top of this layer — using HTTP over TCP/IP.


The TCP/IP Stack: The Developer’s Friend

While the OSI model has seven layers, most real‑world internet communication follows the TCP/IP model, which simplifies it into four layers:

TCP/IP LayerCorresponding OSI LayersKey Example
Network AccessPhysical + Data LinkEthernet, Wi‑Fi
InternetNetworkIP, ICMP
TransportTransportTCP, UDP
ApplicationSession + Presentation + ApplicationHTTP, DNS, TLS

Once you get this mapping, it becomes easier to debug network issues.

For example:


From Code to Cable: A Simple Web Request Journey

Let’s trace what happens when you run this in your browser:

fetch("https://api.example.com/users/1")
  1. Application Layer (HTTP) → Your browser creates an HTTP GET request.
  2. Presentation Layer (TLS) → Data is encrypted via HTTPS.
  3. Transport Layer (TCP) → Data is split into packets and numbered.
  4. Network Layer (IP) → Each packet gets a destination IP address.
  5. Data Link + Physical Layers → Packets travel over wired or wireless media to reach the destination server.

The server responds through the same stack in reverse until your browser reconstructs and renders the JSON.

That entire round trip happens in milliseconds.


Why Developers Should Understand Networking Layers

Knowing the fundamentals helps with:

Modern frameworks like Hono or Tanstack-start backends rely on these layers for HTTP, WebSockets, and cloud connectivity.


Networking may feel abstract, but it’s the invisible fabric of everything online.
Mastering these fundamentals gives you the power and knowledge to make your applications faster, safer, and more reliable — from your frontend fetch call to the backend that answers it.