/blogs/what-is-a-backend-the-server-side-architecture

← Back to blogs
Blog

What Is a Backend? The Server-Side Architecture

Learn what a backend is, how requests flow through DNS, firewalls & servers, and why backend logic can't live in the frontend.

·10 min read·

What is a Backend? Complete Server-Side Architecture

Backend, in its traditional definition, is a computer listening for HTTP, WebSocket, gRPC, or any other kind of request through an open port — whether 80 or 443 — accessible over the Internet, so that clients or frontends can connect, send data, or receive responses.

We call it a server because it serves content: static files (images, JavaScript, HTML) or dynamic data (JSON), and it accepts data when clients send something.

Now we know: What a backend is and how it works.
Let's take a view to see how the components physically work behind the scenes.


#Table of Contents


#The Traditional Definition: What Is a Backend?

Rendering diagram...
ComponentPurpose
Open Port (80/443)Entry point for network traffic
Protocol HandlerParses HTTP, WebSocket, gRPC requests
Request ProcessorBusiness logic, data transformation
Response GeneratorReturns JSON, HTML, static files, or status codes

A backend is not just code—it's a networked system designed to:

  • Accept requests from anywhere on the Internet
  • Process data securely and efficiently
  • Persist state to databases or storage
  • Return structured responses to clients

#Tracing the Request: Backend Flow

Let's trace a real request from browser to server using a deployed backend on AWS.

Step 1: DNS Resolution

URL: http://stellaris.elixircommunity.in ├─ Domain: elixircommunity.in ├─ Subdomain: stellaris └─ DNS Server → Resolves to Public IP
DNS Record TypePurpose
A RecordPoints domain → IPv4 address
CNAME RecordPoints subdomain → another domain

Step 2: AWS EC2 Instance

>_ bash
# The resolved IP belongs to:
AWS EC2 Instance (Public IP: 54.12.34.56)
├─ Region: us-east-1
├─ Instance Type: t3.medium
└─ OS: Ubuntu 22.04 LTS

Step 3: Firewall & Security Groups

Before reaching the server, traffic passes through AWS's native firewall.

>_ text
Security Group Rules:
  - Port 22 (SSH):   Allow → Admin access only
  - Port 80 (HTTP):  Allow → Public web traffic
  - Port 443 (HTTPS): Allow → Encrypted web traffic
  - All other ports: DENY → Blocked by default

If ports 80 or 443 aren't allowed, AWS blocks the request before it reaches your application.

Step 4: Reverse Proxy Configuration (Nginx + Certbot)

Rendering diagram...
>_ nginx
# Simplified Nginx config excerpt
server {
    listen 80;
    server_name stellaris.elixircommunity.in;
    return 301 https://$host$request_uri; # HTTP → HTTPS
}

server {
    listen 443 ssl;
    server_name stellaris.elixircommunity.in;
    
    # SSL managed by Certbot
    ssl_certificate /etc/letsencrypt/live/.../fullchain.pem;
    
    location / {
        proxy_pass http://localhost:3001; # Forward to backend
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
    }
}

Certbot auto-renews SSL certificates
Nginx centralizes routing, SSL termination, and load balancing

>_ bash
### Step 5: Final Server (Node.js on localhost:3001)

```bash
# Process management via npm/pm2
$ pm2 list
idnamestatusportscript
0frontendonline3000next start
1backendonline3001node app.js
>_ text
# Direct localhost test (bypasses DNS/Nginx)
$ curl localhost:3001/api/users
→ Returns same JSON response as public endpoint

Full Request Flow Summary

Rendering diagram...

From browser to backend: 6 hops, 3 security layers, 2 protocol translations.


#Why Do We Need Backends? The Instagram Example

Imagine scrolling Instagram, liking a friend's post. What happens between your tap and their notification?

Rendering diagram...

Why a Centralized Server Is Non-Negotiable

RequirementWhy Frontend Alone Fails
User IdentityFrontend can't securely verify identity without server-side auth
Data PersistenceBrowser storage (localStorage) is device-specific, not shared
Cross-User ActionsYour action must affect another user's experience → needs global state
Notification DeliveryPush services require server-to-server communication (APNs, FCM)

The backend is the single source of truth—it holds all user data, all relationships, all business logic.
Frontends are personalized views into that centralized system.


#Core Backend Responsibility: Data

If we distill backend responsibility to one word: data.

>_ text
// Every backend operation revolves around data:
const backendResponsibilities = {
  fetch:    'GET /users/:id → Retrieve from DB',
  receive:  'POST /posts → Accept & validate input',
  persist:  'INSERT INTO likes (...) → Save state',
  transform:'Format, filter, aggregate before response',
  secure:   'Encrypt, authorize, audit every access'
};

Any action that deals with data—creation, reading, updating, deletion, synchronization—belongs in the backend.


#Why Not Do Everything on Frontend?

Technically, your phone/laptop is a computer. So why not connect directly to the database from the browser?

Short Answer: Security, Control, and Scale

Let's see why by examining how frontends actually work.


#Frontend Flow: How the Browser Executes Code

Deployment: Next.js on Same AWS Instance

>_ bash
# Same EC2 instance, different port
frontend.xyz → DNS → Same Public IP → Nginx → localhost:3000 (Next.js)

Browser Rendering Pipeline

Rendering diagram...
  • HTML → Structure & initial paint
  • CSS → Styling & visual polish
  • JavaScript → Interactivity & dynamic behavior

Key Insight: The Browser Is the Runtime

>_ bash
+ Frontend: Code is SENT to client → Browser EXECUTES it
+ Backend: Code RUNS on server → Server SENDS result
AspectFrontendBackend
RuntimeBrowser (V8, SpiderMonkey)Node.js, Python, Go, Java
Execution LocationUser's deviceServer/Cloud
Data AccessLimited (DOM, localStorage)Full (DB, FS, APIs, env vars)
Security BoundarySandbox (isolated)Privileged (controlled)

#Backend vs Frontend: The Key Difference

Frontend: "Send me the code, I'll run it here."
Backend: "Send me the request, I'll run the code and send you the result."

Rendering diagram...

#Frontend Limitations: The Sandbox Reality

Browsers are sandboxed environments—isolated from the OS, filesystem, and network for security.

What Browser Code Can Access

>_ text
DOM (Document Object Model)
Browser APIs: 
   - localStorage / sessionStorage
   - cookies (with restrictions)
   - fetch() / XMLHttpRequest
   - geolocation, camera, microphone (with permission)
External APIs *only if* they allow CORS

What Browser Code Cannot Access

>_ text
File system (no reading/writing arbitrary files)
Environment variables (no process.env.DB_PASSWORD)
Native database drivers (no pg, mongoose, mysql2)
Persistent socket connections (no long-lived DB pools)
Arbitrary external APIs (blocked by CORS policy)

CORS: The Browser's Security Policy

>_ text
# Browser blocks this by default:
Request: GET https://api.other-domain.com/data
Origin: https://frontend.xyz

# Unless the server explicitly allows it:
Response Header:
  Access-Control-Allow-Origin: https://frontend.xyz
  Access-Control-Allow-Methods: GET, POST
  Access-Control-Allow-Headers: Content-Type, Authorization

Why this exists: Imagine visiting a malicious site that runs JavaScript to read ~/.ssh/id_rsa or C:\Users\You\Documents\passwords.txt.
Sandboxing prevents remote code from compromising your device.


#Why Backend Logic Can't Live in Frontend

1️. Security Reasons

>_ bash
+ Backend needs:
  - Access to environment variables (API keys, DB credentials)
  - File system operations (logs, uploads, configs)
  - Privileged system calls (process management, networking)

- Browser forbids all of the above → by design.

2️. External API Restrictions (CORS)

>_ text
// Frontend attempt:
fetch('https://payment-gateway.com/charge', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer secret_key' } //  Exposed in client!
})

// Problems:
// 1. Secret key visible in browser DevTools
// 2. Request blocked if gateway doesn't allow your origin
// 3. No server-side validation or rate limiting

//  Correct approach:
// Frontend → Your Backend → Payment Gateway (server-to-server)

3️. Database Access: Connection Pooling & Drivers

Rendering diagram...
RequirementBackend DriverBrowser Limitation
Socket ConnectionsNative TCP/UNIX socketsOnly HTTP/WebSocket
Binary ProtocolEfficient binary parsingText-only (mostly)
Persistent ConnectionsReuse via poolingNew connection per request
Query OptimizationPrepared statements, EXPLAINNo query planning access

Even if browsers could connect to databases directly:

  • Every user = one DB connection → thousands of concurrent connections
  • No connection pooling → DB server crashes under load
  • Credentials in client code → instant security breach

4️. Computing Power: Device Variability

>_ text
Frontend Device Spectrum:
  - High-end: MacBook Pro M3, 32GB RAM, 8-core CPU
  - Mid-range: Android phone, 4GB RAM, 4-core CPU  
  - Low-end: Old laptop, 2GB RAM, single-core CPU
  - Edge case: Feature phone, 256MB RAM, no JS engine

Backend Server (Scalable):
  - Start: t3.medium (2 vCPU, 4GB RAM)
  - Scale: Auto-add instances, load balancer, caching
  - Optimize: Profile → tune → deploy → repeat

Backend: Control hardware, scale horizontally, optimize centrally
Frontend: At mercy of user's device—can't guarantee performance


#Final Thoughts

The backend isn't optional—it's the foundation.
Frontends are disposable views; backends are persistent truth.

When to Use What

Rendering diagram...

Your Backend Checklist

  • Listens on standard ports (80/443) with proper protocol support
  • Passes through firewall/security groups intentionally
  • Uses reverse proxy (Nginx) for routing, SSL, and resilience
  • Centralizes data logic: fetch, validate, persist, secure
  • Never trusts frontend input—validate everything server-side
  • Scales independently of client device capabilities

The framework will change.
The language will evolve.
The need for a secure, scalable, data-centric backend will never disappear.

Focus on the pipeline. Understand every hop. Build systems that protect data, scale predictably, and serve users—no matter their device.

Master the backend, and you don't just ship features—you engineer trust.


Originally traced through DNS, firewalls, proxies, and servers. Share the map.
#BackendBasics #WebArchitecture #SystemDesign #FullStack

1,092 words left