The backend creates and manages the resources needed to respond to client requests. It focuses on enabling server infrastructure to process requests, supply data, and provide other services securely.
While users never see the backend directly, every meaningful action they take — logging in, searching for products, submitting a payment — is processed by backend code.
What Backend Developers Do
Back-end developers write and maintain the parts of an application that process inputs. They handle:
- Login information — authentication and session management
- Product searches — querying databases and returning filtered results
- Payment information — securely processing transactions
User Action (Browser)
|
v
+------+--------+
| Front-End | (Sends request)
+------+--------+
|
| API call / HTTP request
v
+------+--------+
| Back-End | (Processes logic)
| |
| Validates |
| Queries DB |
| Returns data |
+------+--------+
|
v
Database / Services
How Frontend Interacts with Backend
The frontend communicates with the backend through well-defined interfaces:
| Concept | Description |
|---|---|
| API | Code that works with data, usually using JSON or XML |
| Route | A path to a website or page that the user interacts with |
| Endpoint | Can be an API or a route — the destination of a request |
Back-end developers create routes to direct requests to the correct service. If an endpoint is missing, the server returns a 404 error.
// Example: a simple Express.js route
app.get('/api/products', (req, res) => {
const products = db.query('SELECT * FROM products');
res.json(products);
});
APIs provide a way for cloud apps and frontends to access resources from the back-end without exposing internal implementation details.
Backend Languages and Frameworks
The backend can be written in many languages. Each has mature frameworks that simplify common tasks like routing, middleware, and database access.
JavaScript / Node.js
// Express.js — minimal Node.js web framework
const express = require('express');
const app = express();
app.get('/hello', (req, res) => {
res.send('Hello from the backend!');
});
app.listen(3000);
Popular frameworks:
- Node.js — JavaScript runtime for the server
- Express — minimal, fast web framework for Node.js
Python
# Flask — lightweight Python web framework
from flask import Flask, jsonify
app = Flask(__name__)
@app.route('/api/data')
def get_data():
return jsonify({"status": "ok"})
Popular frameworks:
- Django — full-featured framework with ORM, admin panel, and authentication built in
- Flask — lightweight microframework for smaller or more custom applications
| Language | Framework | Best For |
|---|---|---|
| JavaScript | Node.js + Express | Real-time apps, APIs |
| Python | Django | Full-featured web apps |
| Python | Flask | Lightweight microservices |
Databases
A database is where information can be stored, modified, and retrieved. A web application uses databases to persist state — user accounts, product catalogs, order history, preferences, and more.
+----------------+ Query +----------------+
| Backend App | -------------> | Database |
| | <------------- | |
| Business | Result Set | Tables/Docs |
| Logic | | (Data) |
+----------------+ +----------------+
Working with Databases
Two main approaches are used to interact with databases:
SQL (Structured Query Language) — the standard language for relational databases like PostgreSQL, MySQL, and SQLite.
SELECT name, price FROM products WHERE discount > 0.1;
ORM (Object-Relational Mapping) — a programming technique that connects application code to the database and hides some of the complexity of querying. It allows developers to interact with database records as if they were regular objects in their programming language.
# Django ORM example
products = Product.objects.filter(discount__gt=0.1)
| Approach | Pros | Cons |
|---|---|---|
| Raw SQL | Full control, maximum performance | More verbose, database-specific |
| ORM | Cleaner code, portable, faster development | Can hide performance issues |
Summary
Backend development is the engine that powers every web application. A backend developer must understand:
- Server-side languages and frameworks to process business logic
- APIs and routing to expose data to the frontend
- Databases and query languages to store and retrieve information
- Security and authentication to protect user data
The backend is invisible to the user but essential to every interaction they have.