Everything from the map above, on one page. Dashed topics are optional. The hours are rough estimates for reading plus hands-on practice.
Stage 1 · Beginner HTTP and your first API
Understand what happens between a client and a server, then build a small JSON API that validates its input and returns proper errors. Pick one language for the whole roadmap; the ideas carry over to every other one.
What a backend does: the request lifecycle
A backend is the code that runs on a server: it receives requests from browsers, mobile apps or other services, applies business rules, reads and writes data, talks to other systems and sends back a response. The frontend shows things; the backend decides what is true and who is allowed to do what.
Follow one request from end to end: the client looks up the server's address (DNS), opens a connection (TCP, usually with TLS), sends an HTTP request; a load balancer or reverse proxy passes it to your application; your framework's router picks a handler, middleware runs first (logging, authentication, body parsing), the handler validates input, calls a database or cache, and builds a response. Almost every topic in this roadmap is one step of that journey.
What to learn
- Client, server, request and response, and why the server is the source of truth
- The path of a request: DNS → TCP/TLS → reverse proxy → app → database → response
- Routing, handlers (controllers) and middleware
- Stateless servers: why each request should carry everything needed to handle it
- Where a backend fits next to frontends, mobile apps and other services
Free resources
Practice
Open your browser's developer tools on any website, go to the Network tab, reload, and pick one request. Write down its method, URL, status code, three request headers and three response headers, and what each one is for.
Networking basics: DNS, TCP, TLS and ports
You can write APIs without being a network engineer, but a little networking explains many real bugs. DNS turns a name into an IP address. TCP gives a reliable, ordered byte stream between two ports, at the cost of a handshake before any data flows. TLS adds encryption and proves the server's identity with a certificate, which is what turns HTTP into HTTPS.
Your server listens on a port (for example 3000 or 8080); a server bound to 127.0.0.1 is only reachable from the same machine, while 0.0.0.0 accepts connections from outside, which matters inside containers. Timeouts, "connection refused" and certificate errors all make sense once you know these layers.
What to learn
- IP addresses, ports, and
localhost / 127.0.0.1 vs 0.0.0.0
- DNS records (A, AAAA, CNAME) and checking them with
dig or nslookup
- The TCP handshake, keep-alive connections and why connection reuse matters
- TLS certificates, the chain of trust, and what HTTPS protects
- Reading "connection refused", "timed out" and certificate errors
Free resources
Practice
Run curl -v https://example.com and find the DNS lookup, the TLS handshake, the certificate details and the HTTP request in its output. The Linux networking topic goes further with ss, dig and ip.
HTTP: methods, status codes and headers
HTTP is the language of the backend. A request has a method, a path, headers and an optional body; a response has a status code, headers and a body. The method says what you want: GET reads, POST creates or triggers an action, PUT replaces, PATCH changes part of a resource, DELETE removes. Safe methods (GET, HEAD, OPTIONS) don't change anything; idempotent methods (the safe ones plus PUT and DELETE) have the same effect whether you send them once or five times, which is what makes retries safe. POST and PATCH are not idempotent by default.
Status codes are grouped by their first digit: 2xx success (200 OK, 201 Created, 204 No Content), 3xx redirects and 304 Not Modified, 4xx the client got something wrong (400, 401 not authenticated, 403 not allowed, 404, 409 conflict, 422, 429 too many requests), 5xx the server failed (500, 502, 503, 504). Headers carry everything else: Content-Type, Authorization, Cache-Control, cookies. HTTP/2 and HTTP/3 change how bytes travel (multiplexing, QUIC over UDP) but keep exactly the same methods, codes and headers.
What to learn
- The parts of a request and a response, and how to see them with
curl -i / curl -v
- Methods, and which are safe and idempotent
- Status code classes and the 15 or so codes you'll use every week (401 vs 403, 404, 409, 422, 429)
- Common headers:
Content-Type, Accept, Authorization, Location, Cache-Control, Set-Cookie
- Query strings, path parameters and URL encoding
- What HTTP/2 and HTTP/3 change, and what they don't
Free resources
Practice
Use curl -i against a public API (for example https://api.github.com/users/octocat) and explain every response header. Then trigger a 404, a 301 and a 304 (send If-None-Match with the ETag you got back) on purpose.
Choosing a language and a web framework
Any mainstream language can run a great backend, so pick one that has jobs where you live and stick with it for this roadmap. Popular choices: JavaScript/TypeScript on Node.js (Express, Fastify, NestJS), Python (FastAPI, Django, Flask; new to Python? see the Python roadmap), Java or Kotlin (Spring Boot; new to Java? see the Java roadmap), Go (the standard net/http package, or Gin and Echo) and C# (ASP.NET Core). Go and Java handle many requests in parallel with lightweight threads; Node.js runs your code on one thread with an event loop and non-blocking I/O, so CPU-heavy work blocks every request.
A web framework gives you routing, middleware, request parsing and a way to send responses. "Micro" frameworks (Express, Flask, Gin) are small and let you choose the rest; "batteries-included" ones (Django, Spring Boot, NestJS) bring an ORM, validation, auth and structure. Learn the language's package manager and project layout too: npm/pnpm, pip/uv with a virtual environment, Maven/Gradle, Go modules.
What to learn
- Pick one language and one framework, and know why
- Create a project with its package manager, add a dependency and pin versions with a lock file
- Define routes with path and query parameters, and read headers and a JSON body
- Write a middleware (for example, one that logs every request and its duration)
- The concurrency model: event loop vs threads vs goroutines, and async/await
Free resources
Practice
Build a "hello" service with three routes: GET /health returns {"status":"ok"}, GET /hello/:name greets by name, and GET /time?tz=… returns the current time. Add a middleware that logs the method, path, status and duration of every request.
REST APIs: resources and CRUD
REST is a style for HTTP APIs built around resources: nouns with URLs, such as /books and /books/42. You act on them with HTTP methods instead of inventing verbs: GET /books lists, POST /books creates (and returns 201 Created with a Location header), GET /books/42 reads, PATCH or PUT /books/42 updates, DELETE /books/42 removes (often 204 No Content). Related resources nest one level: /authors/7/books.
REST servers are stateless: no session memory between requests, so any server instance can handle any request. Most "REST APIs" in the wild are really pragmatic JSON-over-HTTP APIs, and that is fine. What matters is that they are predictable: plural nouns, consistent status codes, the same error format everywhere.
What to learn
- Resources, collections and URLs; nouns, not verbs (
POST /orders, not /createOrder)
- CRUD mapped to POST / GET / PUT or PATCH / DELETE, with the right status codes
- PUT (replace the whole resource) vs PATCH (change some fields)
- Statelessness, and what Roy Fielding's REST constraints actually are
- Nested resources and when to stop nesting
Free resources
Practice
Build a CRUD API for a reading list (books with title, author, status) kept in memory. Return 201 + Location on create, 404 for unknown ids and 204 on delete. Test every route with curl or the API tester.
JSON, serialization and content types
Most APIs speak JSON. Serialization turns your objects into JSON text and deserialization turns incoming JSON back into objects, and that is where many subtle bugs live: dates (send ISO 8601 strings in UTC, such as 2026-10-22T09:30:00Z), big integers (JavaScript loses precision above 253, so send 64-bit ids as strings), money (use integer cents or decimal strings, never floats) and null vs a missing field.
The Content-Type: application/json header tells the other side what the body is, and Accept says what the client wants back (content negotiation). Pick one naming style for fields (camelCase or snake_case) and use it everywhere. Never return your database rows directly: map them to response objects (DTOs) so you don't leak internal fields such as password hashes.
What to learn
- JSON syntax and types, and how your language maps them
- Dates, time zones, big numbers and money in JSON
Content-Type, Accept and 415 / 406 responses
- Response objects (DTOs) instead of raw database rows
- Describing a payload with JSON Schema or typed models
Free resources
Practice
Add createdAt (UTC, ISO 8601) and a price in cents to your reading-list API, and make sure the stored internal fields never appear in responses. Paste a response into the JSON-to-types tool and compare the generated types with your own model.
Input validation and error handling
Never trust input: anything in the body, query string, headers or path can be missing, the wrong type, too long or malicious. Validate at the edge of your API with a schema library (Zod or Joi in Node, Pydantic in Python, Bean Validation in Java, struct tags with a validator in Go) and reject bad requests with 400 Bad Request or 422 Unprocessable Content plus a message that says which field is wrong. Prefer allow-lists (what is valid) over trying to spot bad values.
Handle errors in one place: a central error handler turns exceptions into consistent JSON responses, logs the details with a request id, and never shows stack traces or SQL to the client. RFC 9457 Problem Details (application/problem+json with type, title, status, detail) is a standard error format worth copying. Distinguish errors the client can fix (4xx) from bugs and outages (5xx).
What to learn
- Schema validation for body, query and path parameters, with your stack's library
- Allow-list validation: types, lengths, ranges, formats and enums
- A central error handler and a single error format (RFC 9457 Problem Details)
- 400 vs 422 vs 409 vs 500, and messages that help without leaking internals
- Request ids that tie an error response to its log line
Free resources
Practice
Add validation to the reading-list API: title 1–200 characters, status one of to-read / reading / done. Return Problem Details JSON listing every invalid field, and make an unexpected exception return a generic 500 with a request id while the full stack trace goes to the log.
Am I ready? Stage 1 quiz
Which HTTP method is idempotent but not safe?
GETPOSTPUTHEAD
PUT changes data, so it isn't safe, but sending the same PUT twice leaves the resource in the same state, so it is idempotent. GET and HEAD are both; POST is neither.
A logged-in user asks for another customer's invoice they have no right to see. Which status code fits best?
- 403 Forbidden (or 404 to hide that it exists)
- 401 Unauthorized
- 400 Bad Request
- 500 Internal Server Error
401 means "we don't know who you are". The user is authenticated, just not allowed, which is 403; many APIs return 404 so they don't reveal the invoice exists.
What should a successful POST /books that creates a book return?
- 200 OK with an empty body
- 204 No Content
- 302 Found pointing at
/books - 201 Created with a
Location: /books/{id} header and the new book
201 says a resource was created, and Location tells the client where it lives.
Your API returns order ids as JSON numbers like 9007199254740993. What goes wrong in a JavaScript client?
- Nothing, JSON numbers are unlimited
- The id is silently rounded, because JavaScript numbers are exact only up to 253
JSON.parse throws an error- The id becomes a string automatically
JavaScript uses 64-bit floats, so large integers lose precision without any error. Send big ids as strings.
An unexpected database exception happens while handling a request. What should the client receive?
- The full stack trace, to help debugging
- The SQL query that failed
- A generic 500 error with a request id; the details go to your logs
- A 200 with
{"ok": false}
Internal details help attackers and confuse clients. Log them on the server with a request id the client can quote.
Stage 2 · Data and storage Databases, caching and files
Almost every backend is a thin layer over a database. Learn to model data, query it efficiently and safely, keep hot data in a cache, and store files where they belong. The SQL & Databases roadmap goes deeper on everything database-related here.
Relational databases and SQL
A relational database such as PostgreSQL or MySQL stores data in tables with a fixed schema and lets you combine them with SQL. Start with PostgreSQL: it is free, standard and powerful. Learn to design tables with primary keys, foreign keys, NOT NULL and UNIQUE constraints, write SELECT with WHERE, JOIN, GROUP BY and ORDER BY, and let the database enforce rules your code might forget.
Three ideas matter most for backend work. Indexes make lookups fast (and writes a little slower); a query that scans a whole table is the most common performance bug. Transactions make several changes all-or-nothing (ACID), for example "take money from A and give it to B". Parameterised queries keep user input out of the SQL text, which is what stops SQL injection.
What to learn
- Tables, primary and foreign keys, constraints and data types
- SELECT, INSERT, UPDATE, DELETE, JOINs, GROUP BY and aggregates
- Indexes and reading a query plan with
EXPLAIN
- Transactions, ACID, and what isolation levels protect against
- Parameterised queries / prepared statements from your language's driver
- Connection pools: why opening a connection per request doesn't scale
Free resources
Practice
Move your reading-list API to PostgreSQL (run it with Docker: docker run -e POSTGRES_PASSWORD=dev -p 5432:5432 postgres). Add users and a many-to-many "shelves" table, use parameterised queries everywhere, and add an index for the query your list endpoint runs. The SQL roadmap goes deeper on schema design, joins, indexes, transactions and isolation levels.
ORMs, query builders and migrations
An ORM (object-relational mapper) maps tables to classes so you can write user.books instead of SQL: Prisma, Drizzle or TypeORM in Node, SQLAlchemy or the Django ORM in Python, Hibernate/JPA in Java, GORM in Go. Query builders (Knex, jOOQ, sqlc in Go) stay closer to SQL. ORMs save time on simple CRUD but hide what runs: the classic trap is the N+1 problem, where loading 100 orders and then each order's customer runs 101 queries instead of one or two. Learn eager loading (joins or batched IN queries) and turn on SQL logging in development.
Your schema changes over time, so treat it as code: migrations are versioned scripts (Prisma Migrate, Alembic, Flyway or Liquibase, golang-migrate) that move every environment's database forward in the same order. Never edit a migration that has already run in production; add a new one. For zero-downtime deploys, make changes in backward-compatible steps (add a column, deploy code that writes both, backfill, then remove the old one).
What to learn
- Models, relations and basic queries in your stack's ORM
- Spot and fix N+1 queries with eager loading; log the SQL the ORM runs
- When to drop down to raw SQL (reports, bulk updates)
- Migrations: create, apply, roll back, and run them in CI and deploys
- Backward-compatible schema changes (expand, migrate, contract)
Free resources
Practice
Add an ORM and migrations to your project. Write an endpoint that lists 50 books with their authors, count the queries it runs with SQL logging on, then fix it so it runs at most two. Add a migration that renames a column safely in two steps.
NoSQL: documents, key-value and when to use them
"NoSQL" covers very different databases. Document stores (MongoDB) keep JSON-like documents with flexible fields, which suits data read together as one unit. Key-value stores (Redis, DynamoDB) are extremely fast lookups by key. Wide-column (Cassandra) and search engines (Elasticsearch, OpenSearch) handle huge write volumes and full-text search.
They usually trade joins and flexible queries for scale or speed, so you design around your access patterns up front. For most new applications a relational database is the right default; add a NoSQL store when a specific need (a cache, a job queue, search, massive scale) calls for it. PostgreSQL's jsonb covers many "I need flexible fields" cases on its own.
What to learn
- Document, key-value, wide-column, graph and search databases, with one example each
- Embedding vs referencing in a document model
- Designing keys around access patterns (DynamoDB-style)
- PostgreSQL
jsonb as a middle ground
Free resources
Practice
Model your reading list as MongoDB documents (embed or reference the books?) and write down the queries that become easier and harder. Compare with the NoSQL overview on the SQL roadmap and the DynamoDB topic on the AWS roadmap.
Caching: HTTP caching and Redis
A cache keeps a copy of expensive results so the next request is fast. There are two layers to know. HTTP caching lets browsers, CDNs and proxies reuse responses: Cache-Control: max-age=60 says "reuse for 60 seconds", private keeps per-user data out of shared caches, no-store means never cache, and an ETag lets clients revalidate with If-None-Match and get a tiny 304 Not Modified.
Inside your backend, an in-memory store such as Redis (or Valkey, its open-source fork) caches database results. The usual pattern is cache-aside: read from the cache; on a miss, read the database and store the result with a TTL. The hard part is invalidation: delete or update the key when the data changes, and accept that cached data may be a little stale. Watch for a stampede, when a popular key expires and hundreds of requests hit the database at once.
What to learn
Cache-Control directives, ETag / If-None-Match and 304 responses
- Redis basics: strings, hashes, TTLs,
INCR, and running it locally
- Cache-aside, write-through and TTL-based expiry
- Invalidation strategies and cache keys that include everything the result depends on
- Cache stampedes, and what should never be cached (per-user data in shared caches)
Free resources
Practice
Add Redis cache-aside to your slowest read endpoint with a 60-second TTL, delete the key when the data changes, and measure the difference with the load tester. Add an ETag to one GET endpoint and check that a repeat request returns 304. The System Design caching topic covers caching at scale.
File uploads and object storage
Files don't belong in your database or on your server's disk (it disappears when a container is replaced, and isn't shared between instances). Store them in object storage such as Amazon S3, Google Cloud Storage or MinIO, and keep only the key and metadata in the database. Browsers upload with multipart/form-data; for large files, let the client upload straight to storage with a short-lived presigned URL so the bytes never pass through your API.
Uploads are a classic attack surface. Limit the size, check the real file type (not just the extension or the client's Content-Type), generate your own file names, never serve uploads from your application's domain with executable types, and scan them if users share files with each other.
What to learn
multipart/form-data and streaming uploads instead of loading them into memory
- Object storage: buckets, keys, metadata and private-by-default access
- Presigned URLs for direct upload and download
- Upload security: size limits, type checks, generated names, separate domain
- Checksums to verify a file arrived intact
Free resources
Practice
Add book cover uploads: the API returns a presigned URL (MinIO in Docker works locally), the client uploads directly, and the API stores only the key. Reject files over 2 MB and anything that isn't really a PNG or JPEG.
Am I ready? Stage 2 quiz
Which is the correct way to stop SQL injection?
- Escaping quotes with a regex
- Parameterised queries (prepared statements), so input is never part of the SQL text
- Only allowing POST requests
- Hiding database error messages
With parameters the database receives the query and the values separately, so a value can never change the query's structure.
Listing 100 orders with their customers runs 101 queries. What is this called?
- A deadlock
- A cache stampede
- A full table scan
- The N+1 query problem
One query for the list plus one per item. Eager loading (a join or one batched IN query) fixes it.
In the cache-aside pattern, what happens on a cache miss?
- The app reads the database, then stores the result in the cache with a TTL
- The cache reads the database by itself
- The request fails with 503
- The app writes to the database first
In cache-aside the application owns the logic: check the cache, fall back to the database, then fill the cache.
Which Cache-Control value is right for a response with a user's private account details?
public, max-age=86400s-maxage=3600private, no-store (or at least private)- No header at all
private keeps it out of shared caches such as CDNs; no-store stops it being stored at all.
Users upload 500 MB videos. What is the best approach?
- Store them in a database BLOB column
- Give the client a presigned URL to upload straight to object storage
- Save them to the API server's local disk
- Base64-encode them into a JSON body
Presigned URLs keep large bytes off your API servers, and object storage is durable and shared by every instance.
Stage 3 · Intermediate Auth, security, API design and testing
Make your API safe to put on the internet and pleasant to use: know who is calling and what they may do, design endpoints other developers can guess, defend against the common attacks, and prove it all works with automated tests.
Authentication: passwords, sessions and JWTs
Authentication answers "who are you?". If you store passwords, never store them in plain text or with a fast hash such as SHA-256: use a slow, salted password hash, Argon2id first, or scrypt or bcrypt. After login the server needs to recognise later requests. The classic way is a session: a random id in a cookie (HttpOnly, Secure, SameSite) that points to session data stored on the server (often in Redis). Sessions are easy to revoke and are the safest default for your own web app.
A JWT (JSON Web Token) is a signed, Base64url-encoded JSON payload (header.payload.signature) with claims such as sub, exp, iss and aud. Anyone can read it; the signature only proves it wasn't changed. Servers can check it without a database lookup, which suits APIs and services, but it can't be revoked before it expires, so keep access tokens short-lived (minutes) and pair them with a refresh token. Always verify the signature, pin the expected algorithm (never accept alg: none) and check exp, iss and aud. For machine-to-machine calls, simple API keys (stored hashed) are common. To go deeper (OAuth, OIDC, SSO, MFA, passkeys), see the Authentication & Identity roadmap.
What to learn
- Password hashing with Argon2id, scrypt or bcrypt, and why fast hashes are wrong
- Session cookies and the
HttpOnly, Secure and SameSite flags
- JWT structure and claims, and validating signature, algorithm,
exp, iss, aud
- Short-lived access tokens + refresh tokens, and logout / revocation
- API keys for machine clients, stored hashed and rotatable
- Login protections: rate limits, generic error messages, multi-factor authentication
Free resources
Practice
Add sign-up and login to your API with Argon2id or bcrypt. Issue a 15-minute JWT access token plus a refresh token, protect the write endpoints with middleware, and paste a token into the JWT decoder to see that anyone can read its claims. Then try a token with a changed payload and confirm it is rejected.
Authorization: roles, permissions and ownership
Authorization answers "what may you do?", and getting it wrong is the number one risk in both the OWASP Top 10 (Broken Access Control) and the OWASP API Security Top 10 (Broken Object Level Authorization). The typical bug: GET /invoices/1043 checks that the caller is logged in, but not that invoice 1043 is theirs, so changing the number shows someone else's data.
Check permissions on the server for every request, close to the data. Role-based access control (RBAC: admin, editor, viewer) covers most apps; attribute-based rules ("owners can edit their own drafts") handle the rest. Deny by default, put checks in one reusable place (middleware, policy functions or a library such as CASL, Casbin or Spring Security), and test that a user cannot reach other users' data.
What to learn
- Authentication vs authorization, and 401 vs 403
- Object-level checks: always filter by owner or tenant, e.g.
WHERE id = $1 AND user_id = $2
- Roles and permissions (RBAC), and attribute-based rules
- Deny by default, and centralised policy checks
- Mass assignment: never let clients set fields like
role or isAdmin
Free resources
Practice
Create two users and an admin. Write tests proving that user A gets 404 or 403 for user B's books on read, update and delete, that only admins can delete any book, and that sending "role":"admin" in a profile update is ignored.
OAuth 2.0 and OpenID Connect
OAuth 2.0 lets an app act on a user's behalf at another service without seeing their password ("allow this app to read your GitHub repositories"). OpenID Connect (OIDC) builds login on top of it ("Sign in with Google"), adding an ID token (a JWT about the user). Web and mobile apps should use the authorization code flow with PKCE; the old implicit flow and the password grant are deprecated by the OAuth security best practice (RFC 9700). Server-to-server calls use the client credentials flow.
In practice you rarely build an OAuth server yourself: use an identity provider (Keycloak, Auth0, Okta, Amazon Cognito, Microsoft Entra ID) and a well-known client library, and validate the tokens it issues in your API. Understand the roles (resource owner, client, authorization server, resource server), scopes, and the redirect and state parameters that stop login CSRF.
What to learn
- The four OAuth roles, scopes and access tokens
- Authorization code flow with PKCE, step by step
- Client credentials flow for service-to-service calls
- OpenID Connect: ID tokens, the
userinfo endpoint and discovery documents
- Validating provider tokens in your API (JWKS,
iss, aud)
Free resources
Practice
Add "Sign in with GitHub" (or Google) to your app using the authorization code flow with PKCE and a maintained library. Decode the tokens you receive, and write down which one your API should trust and why.
API design: pagination, versioning and OpenAPI
A good API is consistent and hard to misuse. Lists need pagination: offset/limit is simple but slow and unstable on big, changing tables; cursor (keyset) pagination returns an opaque next token and stays fast. Add filtering and sorting with query parameters (?status=done&sort=-createdAt), and use one error format everywhere. Plan for change: adding fields is safe, removing or renaming them breaks clients, so introduce a new version (/v2/ or a header) only for breaking changes, and announce deprecations.
Make retries safe: clients retry after timeouts, so a POST that charges money should accept an idempotency key header and return the original result for a repeated key. Describe the API with an OpenAPI document (OpenAPI 3.1 and 3.2 are current): it drives interactive docs, client generation, mock servers and contract tests. Many frameworks (FastAPI, NestJS, springdoc) generate it from your code.
What to learn
- Naming conventions and a consistent response and error shape
- Offset vs cursor pagination, filtering and sorting
- Versioning, backward-compatible changes and deprecation
- Idempotency keys for unsafe operations
- Writing or generating an OpenAPI document, and serving interactive docs
Free resources
Practice
Add cursor pagination and filtering to your list endpoint, an Idempotency-Key header to POST, and an OpenAPI document with interactive docs. Generate a client from the document and use it in a small script. The System Design APIs topic compares REST, GraphQL and gRPC at scale.
Security basics: OWASP Top 10 for backends
The OWASP Top 10 (2025 edition) and the OWASP API Security Top 10 list the mistakes attackers exploit most: broken access control, security misconfiguration, vulnerable dependencies (supply chain), weak cryptography, injection (SQL, NoSQL, OS commands), authentication failures, and missing logging. Most are prevented by habits you've already met: parameterised queries, validation, server-side authorization checks and good password storage.
Add the rest: HTTPS everywhere with HSTS, secure headers, keep dependencies updated (Dependabot, npm audit, pip-audit), never fetch user-supplied URLs without an allow-list (that's SSRF), limit request body sizes, and configure CORS narrowly. Remember that CORS is enforced by browsers to protect users; it does not stop curl or another server from calling your API, so it is never a substitute for authentication.
What to learn
- The OWASP Top 10 and API Security Top 10 categories, with one example of each
- Injection: SQL, NoSQL and command injection, and how to prevent them
- CORS: preflight requests,
Access-Control-Allow-Origin, and what CORS does not protect
- CSRF with cookie sessions, and the
SameSite cookie defence
- SSRF, request size limits and secure response headers
- Dependency scanning and keeping libraries patched
Free resources
Practice
Audit your own API against the API Security Top 10 and fix at least three findings. Run your language's dependency audit, set a body size limit, restrict CORS to your frontend's origin, and check your HTTPS certificate with the SSL decoder. The System Design security topic continues at the architecture level, and the Web Security roadmap goes deep on every OWASP category with hands-on labs.
Rate limiting and abuse protection
Rate limits protect your API from overload, brute-force logins, scraping and runaway clients, and make usage fair between customers. The common algorithms: fixed window (100 requests per minute, simple but bursty at window edges), sliding window, and token bucket (a bucket refills at a steady rate and each request takes a token, which allows short bursts). Limit per API key, user or IP, and set stricter limits on expensive or sensitive endpoints such as login.
When a client is over the limit, answer 429 Too Many Requests with a Retry-After header. With several server instances, the counters must be shared, usually in Redis with an atomic INCR + expiry or a small Lua script. API gateways and reverse proxies (NGINX, cloud API gateways) can enforce limits before requests reach your code.
What to learn
- Fixed window, sliding window and token bucket, with their trade-offs
- Choosing the key: API key, user id or IP address
- 429 responses with
Retry-After, and client-side backoff
- Shared counters in Redis for multiple instances
- Limits at the gateway or proxy vs in the application
Free resources
Practice
Add a Redis token-bucket limiter: 5 login attempts per minute per IP and 100 requests per minute per user elsewhere. Hit it with the load tester and check that the extra requests get 429 with Retry-After. Compare with the System Design rate limiting topic.
Testing backends: unit, integration and API tests
Tests let you change code without fear. The test pyramid suggests many fast unit tests for pure logic (pricing rules, validation), fewer integration tests that run your code against a real database, and a handful of end-to-end tests through HTTP. For backends, integration tests give the most confidence per test: start a real PostgreSQL in a container with Testcontainers instead of mocking the database, and call your endpoints in-process (Supertest, FastAPI's TestClient, Spring's MockMvc, Go's httptest).
Use your language's standard tools: Jest, Vitest or the built-in node:test in Node, pytest in Python, JUnit with AssertJ in Java, the testing package in Go. Keep each test independent (fresh data or a rolled-back transaction per test), test the unhappy paths (400, 401, 403, 404, 409) as carefully as the happy ones, and run everything in CI on every pull request. Contract tests check that you still match your OpenAPI document.
What to learn
- Unit tests with your language's test framework, and mocking only true external services
- Integration tests against a real database with Testcontainers or Docker Compose
- HTTP-level tests for each endpoint, including error and permission cases
- Test data: factories or fixtures, and isolating tests from each other
- Coverage as a guide, not a goal; running tests in CI
Free resources
Practice
Write unit tests for your validation rules and integration tests for every endpoint of your API against a real PostgreSQL in a container, including the authorization tests from the previous topic. Run them in GitHub Actions on every push (see the Git roadmap's Actions topic).
GraphQL and gRPC
GraphQL exposes one endpoint and a typed schema; clients ask for exactly the fields they need in one query, which suits apps with many different screens. The costs: HTTP caching is harder, the N+1 problem returns inside resolvers (fix it with a DataLoader), and you must limit query depth and cost so one query can't overload the server.
gRPC defines services and messages in Protocol Buffers, generates client and server code in many languages, and sends compact binary messages over HTTP/2 with streaming in both directions. It shines for fast internal service-to-service calls; browsers need a proxy (gRPC-Web), so public APIs usually stay REST.
What to learn
- GraphQL schemas, queries, mutations and resolvers
- DataLoader batching, and depth and cost limits
- Protocol Buffers and generating gRPC code
- Unary vs streaming RPCs, deadlines and status codes
- When to choose REST, GraphQL or gRPC
Free resources
Practice
Expose your books and authors through a small GraphQL endpoint and use a DataLoader so a query for 20 books with authors runs two SQL queries. Or define a .proto for a "recommendations" service and call it over gRPC from your main API.
Am I ready? Stage 3 quiz
Which is the right way to store user passwords?
- AES encryption with a key in the config
- SHA-256 of the password
- Base64-encoded
- A slow, salted password hash such as Argon2id or bcrypt
Fast hashes can be brute-forced at billions of guesses per second, and encryption can be reversed. Password hashes are deliberately slow and salted.
What does a JWT's signature guarantee?
- That the token wasn't changed since it was signed by someone holding the key
- That nobody can read the payload
- That the token can be revoked at any time
- That the user is still logged in
A signed JWT is readable by anyone (it's just Base64url). The signature only protects integrity; revocation needs short expiry or a deny list.
A logged-in user changes /orders/1001 to /orders/1002 and sees a stranger's order. What is this vulnerability?
- SQL injection
- Cross-site scripting
- Broken object level authorization (IDOR)
- CSRF
The API checked that the user was logged in but not that the order belongs to them. Filter every lookup by owner.
Which list pagination stays fast and stable on a large table that changes often?
?page=5000&size=20 offset pagination- Cursor (keyset) pagination with an opaque
next token - Returning all rows and letting the client page
- Random sampling
Large offsets make the database skip thousands of rows, and inserts shift pages. A cursor continues from the last seen key using an index.
Your API has a strict CORS policy that only allows your frontend's origin. What does that protect against?
- All unauthorised API calls, including from curl
- SQL injection
- DDoS attacks
- Other websites' JavaScript reading your API's responses in a visitor's browser
CORS is enforced by browsers. Scripts, servers and curl ignore it, so it never replaces authentication.
Stage 4 · Advanced Production-ready backends
Run your service for real: configuration and secrets, background work, real-time updates, logs, metrics and traces, containers and deployment, and making it fast. The DevOps roadmap and the System Design roadmap pick up where this stage ends.
Configuration and secrets
The same build should run in development, staging and production; only the configuration changes. The Twelve-Factor App puts config in environment variables: database URLs, API keys, feature flags. Read and validate all of it once at startup (fail fast if something is missing), keep a .env file for local development only, and commit a .env.example without real values.
Secrets (passwords, keys, tokens) need more care: never commit them, never log them, and keep production secrets in a secrets manager (AWS Secrets Manager, Google Secret Manager, HashiCorp Vault, Kubernetes Secrets, your CI's encrypted secrets). Give each environment its own credentials, rotate them, and prefer short-lived credentials such as cloud IAM roles over long-lived keys.
What to learn
- Config in environment variables, validated at startup
.env for local development, .env.example committed, .env in .gitignore
- Secrets managers and injecting secrets at runtime
- Rotation, separate credentials per environment, and short-lived IAM roles
- What to do when a secret leaks (revoke first, then clean up)
Free resources
Practice
Move every setting in your API to environment variables with a typed, validated config module that refuses to start when one is missing. Add a .env.example, then load the same values into Docker Compose and a GitHub Actions workflow with the .env converter. See also the DevOps secrets topic.
Message queues and event-driven work
Not everything should happen while the user waits. A message queue lets one part of the system hand work to another: the API puts a message ("send welcome email to user 42") on a queue and returns at once; a consumer processes it later. Queues absorb traffic spikes, let you scale workers separately and keep a failing email provider from breaking sign-ups. Common choices: RabbitMQ, Amazon SQS, Redis-based queues, and Apache Kafka, which is a durable log that many consumers can replay.
Most queues deliver at least once, so the same message may arrive twice: make consumers idempotent (for example, record processed message ids). Failed messages are retried with backoff and, after several attempts, moved to a dead-letter queue for inspection. With publish/subscribe, one event ("order placed") reaches several independent consumers.
What to learn
- Producers, consumers, queues and topics; point-to-point vs publish/subscribe
- At-least-once delivery and idempotent consumers
- Acknowledgements, retries with backoff and dead-letter queues
- Ordering guarantees and partitions (Kafka) or FIFO queues
- When a queue helps and when a simple synchronous call is enough
Free resources
Practice
Run RabbitMQ in Docker. Make your API publish a "book finished" event and write a consumer that updates reading statistics. Send the same message twice and show the statistics count it once; make the consumer fail three times and find the message in a dead-letter queue. Then read the System Design queues topic.
Background jobs and scheduled tasks
A job queue library runs slow or retryable work in separate worker processes: sending emails, resizing images, generating reports, calling flaky third-party APIs. Popular ones are BullMQ (Node.js, Redis), Celery (Python), Sidekiq (Ruby), and JobRunr or Spring's scheduling in Java. Jobs need retries with exponential backoff, timeouts, and the same idempotency as queue consumers.
Scheduled jobs (cron) run at fixed times: nightly cleanups, reminder emails. With several app instances, make sure only one runs each schedule (a scheduler in the job library, a lock, or the platform's scheduler). A common bug is saving to the database and then queuing a job, where one succeeds and the other fails; the transactional outbox pattern writes the job into the same database transaction and publishes it afterwards.
What to learn
- A job queue in your stack: enqueue, worker, retries, backoff and timeouts
- Scheduled and recurring jobs with cron expressions (and their time zone)
- Running a schedule exactly once across many instances
- The transactional outbox pattern
- Monitoring jobs: queue length, failures and stuck jobs
Free resources
Practice
Send a welcome email (to a local test inbox such as Mailpit) from a background job with three retries and exponential backoff, and add a nightly job at 02:00 UTC that deletes accounts unconfirmed for 7 days. Write the job into an outbox table in the same transaction as the sign-up.
Real-time: WebSockets and server-sent events
HTTP is request-response: the client asks, the server answers. For live updates (chat, notifications, dashboards, collaborative editing) the server needs to push. Server-sent events (SSE) keep one HTTP response open and stream text events to the browser (text/event-stream, the EventSource API); they are one-way, reconnect automatically and work through most proxies. WebSockets upgrade a connection (101 Switching Protocols) into a full two-way channel, which suits chat and games. Long polling is the fallback for old environments.
Real-time connections are long-lived and stateful, which changes scaling: each server holds thousands of open connections, a message for a user may arrive on a different instance than their connection (use Redis pub/sub or a broker to fan out), and load balancers and proxies need timeouts and upgrade support configured. Authenticate when the connection opens and send heartbeats to detect dead clients.
What to learn
- Polling vs long polling vs SSE vs WebSockets
- SSE:
text/event-stream, event ids and automatic reconnection
- WebSockets: the upgrade handshake, messages, ping/pong and close codes
- Authenticating real-time connections
- Scaling across instances with Redis pub/sub or a message broker
Free resources
Practice
Add an SSE endpoint that pushes "someone finished a book" events, then a small WebSocket chat. Run two instances behind a proxy and make a message sent to one reach clients on the other through Redis pub/sub. The System Design real-time topic covers this at scale.
Logging
Logs are how you find out what happened at 3 a.m. Write structured logs (one JSON object per line with fields like level, time, msg, requestId, userId, durationMs) instead of free text, so a log platform can search and count them. Following the Twelve-Factor App, write to standard output and let the platform (Docker, Kubernetes, a cloud service) collect and ship them.
Use levels sensibly (error for things someone must look at, warn, info for key events, debug off in production), log one line per request with its status and duration, and attach a request or trace id to every line so you can follow one request through the system. Never log passwords, tokens, full card numbers or other secrets and personal data you don't need.
What to learn
- Structured JSON logging with a library: pino (Node.js),
logging/structlog (Python), SLF4J + Logback (Java), log/slog (Go)
- Log levels and what belongs at each
- Request logs and correlation ids passed between services
- Logging to stdout and central collection
- Redacting secrets and personal data
Free resources
Practice
Switch your API to structured JSON logs with a request id on every line, log one line per request, and make sure the Authorization header and passwords are redacted. Then answer "how many 5xx errors in the last hour, and for which routes?" with jq or a log tool. More in the DevOps logging topic.
Observability: metrics, traces and health checks
Logs tell you about single events; metrics tell you how the whole service is doing. Track the RED metrics for every endpoint (Rate, Errors, Duration as percentiles such as p95 and p99, not averages) and saturation (CPU, memory, connection pool, queue length). Prometheus scrapes metrics and Grafana charts them; alert on symptoms users feel, such as error rate and latency, not on every CPU spike.
Distributed tracing follows one request across services and databases as a tree of timed spans, which shows where the time goes. OpenTelemetry is the vendor-neutral standard for traces, metrics and logs: instrument once and send the data to any backend. Also expose health checks: a liveness endpoint (is the process alive?) and a readiness endpoint (can it serve traffic: database reachable, migrations done?), which load balancers and Kubernetes use to route traffic.
What to learn
- RED metrics and the four golden signals (latency, traffic, errors, saturation)
- Counters, gauges and histograms; percentiles vs averages
- Prometheus and Grafana basics, and alerting on symptoms
- Distributed tracing with OpenTelemetry: traces, spans and context propagation
- Liveness and readiness health endpoints
Free resources
Practice
Add OpenTelemetry auto-instrumentation to your API, run Prometheus, Grafana and Jaeger with Docker Compose, and build a dashboard with request rate, error rate and p95 latency per route. Find your slowest request in the traces and explain where its time went. The DevOps monitoring topic and System Design observability topic go further.
Containers: Docker for backend developers
A container image packages your app with its runtime and dependencies so it runs the same on your laptop, in CI and in production. Write a Dockerfile with a small official base image, copy the dependency files and install before copying the source (so layers cache well), use a multi-stage build to leave compilers and dev dependencies out of the final image, run as a non-root user, and add a .dockerignore.
Docker Compose starts your API together with PostgreSQL, Redis and a queue with one command, which makes local development and integration tests reproducible. Inside a container, listen on 0.0.0.0, read config from environment variables, log to stdout and shut down cleanly on SIGTERM.
What to learn
- Images, containers, layers, tags and registries
- A production Dockerfile: small base, layer caching, multi-stage, non-root user
- Docker Compose for the API plus its database, cache and queue
- Volumes, networks and port mapping
- Graceful shutdown on
SIGTERM
Free resources
Practice
Write a multi-stage Dockerfile for your API (aim for an image under 200 MB that runs as non-root) and a compose.yaml that starts it with PostgreSQL, Redis and RabbitMQ. Check both with the Docker validator. The DevOps Docker topic goes deeper.
Deployment and CI/CD
Deploying should be boring and automatic. A CI/CD pipeline runs on every push: lint, test, build the container image, push it to a registry, run database migrations, and deploy. Where to run it: a platform-as-a-service (Render, Fly.io, Heroku, Railway), a managed container service (AWS ECS or App Runner, Google Cloud Run, Azure Container Apps), Kubernetes, or a plain VM behind a reverse proxy such as NGINX or Caddy that terminates TLS (with free Let's Encrypt certificates).
Deploy without downtime: run at least two instances behind a load balancer, use rolling, blue-green or canary deployments, make sure readiness checks gate traffic and that the app finishes in-flight requests on shutdown, and keep migrations backward-compatible. Follow the Twelve-Factor principles (one codebase, config in the environment, stateless processes, logs to stdout) and you can run anywhere. Always know how to roll back.
What to learn
- The Twelve-Factor App principles
- A CI pipeline: test, build, push the image, migrate, deploy
- One hosting option end to end (PaaS, managed containers or a VM)
- Reverse proxies, TLS certificates and HTTPS redirects
- Zero-downtime deploys (rolling, blue-green, canary) and rollbacks
Free resources
Practice
Deploy your API with its database to a free or cheap platform behind HTTPS, with a GitHub Actions pipeline that tests, builds and deploys on every push to main and runs migrations first. Deploy a broken version on purpose and roll it back. Continue with the DevOps CI/CD, web servers and deployment strategies topics.
Performance and load testing
Measure before you optimise. Most backend slowness comes from a few places: database queries (missing indexes, N+1 queries, fetching columns or rows you don't need), too many network round trips, missing caching, and an exhausted connection pool. Use EXPLAIN ANALYZE, your traces and a profiler to find the real bottleneck. In Node.js, CPU-heavy work blocks the event loop for every request, so move it to worker threads or a job.
Load testing shows how the service behaves under realistic traffic: ramp up virtual users, watch p95/p99 latency and error rate, and find the point where it breaks. Tools such as k6, Gatling, Locust and JMeter script this. Then scale: tune pool sizes and timeouts, add caching, add instances (horizontal scaling works because your servers are stateless), and set timeouts on every outgoing call so one slow dependency can't take you down.
What to learn
- Latency percentiles, throughput, and why averages hide problems
EXPLAIN ANALYZE, slow query logs and profilers
- Connection pool sizing and timeouts on all outgoing calls
- Load testing: ramp-up, thresholds and finding the breaking point
- Compression, pagination and avoiding blocking work on the request path
Free resources
Practice
Load-test your list endpoint locally with the load tester (ramp from 1 to 100 virtual users), note p95 and errors, then fix the biggest bottleneck you find (an index, a cache, a pool size) and run it again. Export the test as a k6 script for your CI.
Serverless backends
With functions as a service (AWS Lambda, Google Cloud Functions, Azure Functions) you upload a handler and the platform runs it on demand, scales it to zero when idle and bills per request. Serverless containers (Google Cloud Run, AWS App Runner) do the same for an ordinary container image. They are great for spiky or low traffic, event processing and small APIs.
The trade-offs: cold starts add latency to the first request after idle time, execution time is limited, there is no local disk or in-memory state between calls, and database connections need a proxy or pooling because hundreds of function instances can open connections at once.
What to learn
- Functions vs serverless containers vs always-on servers
- Event triggers: HTTP via an API gateway, queues, schedules, file uploads
- Cold starts, time limits and statelessness
- Database connections from functions (pooling proxies)
Free resources
Practice
Deploy one endpoint of your API as a function behind an API gateway, measure the cold-start and warm latency, and compare the monthly cost estimate with a small always-on server. The AWS roadmap covers Lambda and API Gateway in detail.
Architecture: monoliths, modules and microservices
Start with a well-structured monolith: one deployable app, split inside into modules by business area (users, catalogue, orders) with clear boundaries, often with layers (routes → services → data access). It is simpler to build, test, deploy and debug, and most products never need more.
Microservices split the system into separately deployed services that own their data and talk over HTTP, gRPC or events. They let large teams work and deploy independently, but bring network failures, distributed data, versioning and much harder debugging. Move to them only when team size or very different scaling needs make the monolith hurt, and then carve out services along the module boundaries you already have.
What to learn
- Layered and modular code structure inside one app
- Monolith vs microservices: the real costs and benefits
- Service boundaries and each service owning its data
- Sync calls vs events between services, timeouts and retries
Free resources
Practice
Reorganise your API into modules by business area with no imports between modules' internals. Then write a one-page note on which module you would extract first as a service, what data it would own and how the others would talk to it. Continue with the System Design roadmap.
Am I ready? Stage 4 quiz
Your queue delivers messages "at least once". What must the consumer be?
- Single-threaded
- Written in the same language as the producer
- Idempotent, so processing the same message twice has the same effect as once
- Faster than the producer
At-least-once means duplicates happen. Recording processed message ids (or using natural upserts) makes them harmless.
Where should a production database password live?
- In the Git repository, in
config.json - Baked into the Docker image
- In the application log at startup, for debugging
- In a secrets manager, injected as an environment variable or file at runtime
Secrets must stay out of Git, images and logs. A secrets manager controls access, audits use and supports rotation.
Which pair of metrics best tells you users are having a bad time?
- Error rate and p95/p99 latency
- CPU and memory usage
- Number of log lines and disk space
- Average latency and uptime of the database server
Errors and tail latency are what users feel. CPU and averages can look fine while some requests fail or crawl.
A server needs a dashboard that updates live when new orders arrive; the browser never sends data back on that channel. What is the simplest fit?
- A WebSocket with a custom protocol
- Polling every 100 ms
- Server-sent events
- gRPC streaming from the browser
SSE is one-way server-to-client over plain HTTP, with built-in reconnection. WebSockets are for two-way traffic.
What does a readiness endpoint tell the load balancer?
- That the process hasn't crashed
- Whether this instance can serve traffic right now (for example, its database is reachable)
- The current version number
- How many users are logged in
Liveness says "restart me if I'm stuck"; readiness says "send me traffic or not", which is what makes rolling deploys safe.