Module 2 · Encrypters Team

Backend Development

Servers, databases, frameworks, APIs — everything that runs behind what users see.

← Back to Big Six

1 Backend Fundamentals

The backend is everything users don't see — authentication, business logic, data processing, and API endpoints. Before saving anything, a well-built backend always validates first.
🌐
Client
Browser / App
🛡️
Auth
Validate & Guard
⚙️
Controller
Route Handler
🧠
Service
Business Logic
🗃️
Database
Persist Data
🔒
Authentication
Verify who the user is. Happens before any data is accessed.
Validation
Check that incoming data has the right format before processing.
🧠
Business Logic
Rules specific to your app — pricing, permissions, workflows.
📡
API Endpoints
URLs the frontend calls. Each maps to a controller method.
Validation and authentication always happen before database writes.

2 Databases & APIs

Databases persist your data. APIs expose it. Understanding SQL vs NoSQL and REST principles is foundational to every backend project.
FeatureSQL (Relational)NoSQL (Non-Relational)
StructureFixed schema — tables, rows, columnsFlexible — documents, key-value, graphs
Query languageSELECT * FROM users WHERE id = 1db.users.find({id: 1})
RelationshipsJOINs between tablesEmbedded documents or references
Best forComplex queries, strict consistencyScale, flexible data, rapid iteration
ExamplesPostgreSQL, MySQL, SQLiteMongoDB, Redis, DynamoDB
REST API — CRUD Endpoints (Spring Boot)
@RestController
@RequestMapping("/api/users")
public class UserController {
    @GetMapping           // GET  /api/users     → Read all
    public List<User> getAll() { ... }
    @PostMapping          // POST /api/users     → Create
    public User create(@RequestBody UserDTO dto) { ... }
    @PutMapping("/{id}")   // PUT  /api/users/1   → Update
    public User update(@PathVariable Long id, @RequestBody UserDTO dto) { ... }
    @DeleteMapping("/{id}") // DELETE /api/users/1 → Delete
    public void delete(@PathVariable Long id) { ... }
}

Vocabulary Check

In REST: Create (POST), Read (GET), Update (PUT/PATCH), Delete (DELETE).

3 Backend Frameworks

Flask (Python) is minimal and flexible. Spring Boot (Java) is opinionated and full-featured.
FeatureFlask (Python)Spring Boot (Java)
PhilosophyMicro — bring what you needOpinionated — batteries included
Routing@app.route('/path')@GetMapping('/path')
DB layerSQLAlchemy / raw SQLSpring Data JPA / Hibernate
Best forQuick APIs, ML serving, scriptsLarge enterprise backends
Flask (Python)
python
from flask import Flask, jsonify
app = Flask(__name__)

@app.route('/api/hello')
def hello():
    return jsonify({'message': 'Hello!'})
Spring Boot (Java)
java
@RestController
@RequestMapping("/api")
public class HelloController {
    @GetMapping("/hello")
    public Map<String,String> hello() {
        return Map.of("message", "Hello!");
    }
}
Spring Boot: Controller (routes) → Service (logic) → Repository (database). Never put database calls in a Controller.

4 API Project & Testing

Testing your API before the frontend is built is essential. Select an endpoint and click Send to see a real response shape.
Method + Endpoint Request Preview
http
Select an endpoint above.
Response
Body
Select an endpoint and click Send.
What to look for
Pick an endpoint and send a request.
HTTP status codes: 2xx = success, 4xx = client error, 5xx = server error.

5 Advanced Backend Concepts

Patterns that separate junior from senior backend engineers — security, scalability, observability, and AI integration.
☁️
Serverless
Deploy individual functions without managing a server. Scale to zero when idle.
🔑
JWT Auth
JSON Web Tokens encode user identity. The backend signs them; every request carries the token.
📊
Observability
Logging, metrics, and tracing. You can't fix what you can't see.
🤖
AI Integration
Backend calls to LLM APIs for summarization, classification, generation.
Caching
Redis stores frequent queries in memory. Can cut response times 100x.
🏗️
IaC
Infrastructure as Code — define servers in version-controlled config files.
python — JWT token flow
import jwt, datetime
SECRET = "your-secret-key"

def create_token(user_id):
    payload = {"sub": user_id, "exp": datetime.utcnow() + datetime.timedelta(hours=24)}
    return jwt.encode(payload, SECRET, algorithm="HS256")

def verify_token(token):
    try:
        return jwt.decode(token, SECRET, algorithms=["HS256"])
    except jwt.ExpiredSignatureError:
        raise Exception("Token expired")

6 Free Response & Reflection

Apply everything you've learned. Answer each question thoughtfully.
✅ What You Covered
Step 1 — Backend flow: validate → authenticate → process → persist
Step 2 — SQL vs NoSQL, REST CRUD, HTTP methods & status codes
Step 3 — Flask vs Spring Boot architecture and layering
Step 4 — API testing: status codes, request/response shape
Step 5 — Serverless, JWT, caching, observability, AI integration