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.
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 — whether80or443— 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?
- Tracing the Request: Backend Flow
- Why Do We Need Backends?
- Core Backend Responsibility: Data
- Why Not Do Everything on Frontend?
- Frontend Flow: How the Browser Executes Code
- Backend vs Frontend: The Key Difference
- Frontend Limitations: The Sandbox Reality
- Why Backend Logic Can't Live in Frontend
- Final Thoughts
#The Traditional Definition: What Is a Backend?
| Component | Purpose |
|---|---|
Open Port (80/443) | Entry point for network traffic |
Protocol Handler | Parses HTTP, WebSocket, gRPC requests |
Request Processor | Business logic, data transformation |
Response Generator | Returns 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 Type | Purpose |
|---|---|
A Record | Points domain → IPv4 address |
CNAME Record | Points subdomain → another domain |
Step 2: AWS EC2 Instance
# 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 LTSStep 3: Firewall & Security Groups
Before reaching the server, traffic passes through AWS's native firewall.
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 defaultIf ports
80or443aren't allowed, AWS blocks the request before it reaches your application.
Step 4: Reverse Proxy Configuration (Nginx + Certbot)
# 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
### Step 5: Final Server (Node.js on localhost:3001)
```bash
# Process management via npm/pm2
$ pm2 list| id | name | status | port | script |
|---|---|---|---|---|
| 0 | frontend | online | 3000 | next start |
| 1 | backend | online | 3001 | node app.js |
# Direct localhost test (bypasses DNS/Nginx)
$ curl localhost:3001/api/users
→ Returns same JSON response as public endpointFull Request Flow Summary
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?
Why a Centralized Server Is Non-Negotiable
| Requirement | Why Frontend Alone Fails |
|---|---|
User Identity | Frontend can't securely verify identity without server-side auth |
Data Persistence | Browser storage (localStorage) is device-specific, not shared |
Cross-User Actions | Your action must affect another user's experience → needs global state |
Notification Delivery | Push 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.
// 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
# Same EC2 instance, different port
frontend.xyz → DNS → Same Public IP → Nginx → localhost:3000 (Next.js)Browser Rendering Pipeline
- HTML → Structure & initial paint
- CSS → Styling & visual polish
- JavaScript → Interactivity & dynamic behavior
Key Insight: The Browser Is the Runtime
+ Frontend: Code is SENT to client → Browser EXECUTES it
+ Backend: Code RUNS on server → Server SENDS result| Aspect | Frontend | Backend |
|---|---|---|
Runtime | Browser (V8, SpiderMonkey) | Node.js, Python, Go, Java |
Execution Location | User's device | Server/Cloud |
Data Access | Limited (DOM, localStorage) | Full (DB, FS, APIs, env vars) |
Security Boundary | Sandbox (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."
#Frontend Limitations: The Sandbox Reality
Browsers are sandboxed environments—isolated from the OS, filesystem, and network for security.
What Browser Code Can Access
DOM (Document Object Model)
Browser APIs:
- localStorage / sessionStorage
- cookies (with restrictions)
- fetch() / XMLHttpRequest
- geolocation, camera, microphone (with permission)
External APIs *only if* they allow CORSWhat Browser Code Cannot Access
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
# 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, AuthorizationWhy this exists: Imagine visiting a malicious site that runs JavaScript to read
~/.ssh/id_rsaorC:\Users\You\Documents\passwords.txt.
Sandboxing prevents remote code from compromising your device.
#Why Backend Logic Can't Live in Frontend
1️. Security Reasons
+ 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)
// 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
| Requirement | Backend Driver | Browser Limitation |
|---|---|---|
Socket Connections | Native TCP/UNIX sockets | Only HTTP/WebSocket |
Binary Protocol | Efficient binary parsing | Text-only (mostly) |
Persistent Connections | Reuse via pooling | New connection per request |
Query Optimization | Prepared statements, EXPLAIN | No 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
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 → repeatBackend: 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
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