Backend Engineering
How do I design, build, scale, secure, debug and operate the backend of a real production system? Not how to create an endpoint — what happens from the moment a request reaches your service until data is returned, persisted, queued, cached, retried, observed and served reliably at scale.
Your path through Backend Engineering
Start with these 5 lessons
Then follow the stages in order
Each stage builds on the ones before it. Labs and simulators sit right after the lessons they exercise. Open a stage to see its lessons. Full roadmap with goals →
Request in, response out0 of 17 lessons done
- What a Backend Actually IsFoundation≈ 5 min
- The Request LifecycleFoundation≈ 10 min
- What the Backend Is Responsible ForFoundation≈ 5 min
- The Trust BoundaryFoundation≈ 5 min
- Anatomy of an HTTP ServerFoundation≈ 15 min
- Request and Response ObjectsFoundation≈ 10 min
- Status Codes From the Server's SideFoundation≈ 10 min
- Request Bodies and StreamingFoundation≈ 10 min
- How a Route Becomes a Function CallFoundation≈ 10 min
- Path ParametersFoundation≈ 10 min
- Query ParametersFoundation≈ 10 min
- Route PrecedenceFoundation≈ 10 min
- What a Handler Is Responsible ForFoundation≈ 10 min
- The Middleware PipelineFoundation≈ 10 min
- The Three ValidationsFoundation≈ 10 min
- Transport ValidationFoundation≈ 10 min
- Reporting Validation FailuresFoundation≈ 10 min
Structure, data access and who is calling0 of 19 lessons done
- Transport, Application, Domain, InfrastructureFoundation≈ 10 min
- The Service LayerFoundation≈ 10 min
- The Repository LayerFoundation≈ 10 min
- Fat ControllersFoundation≈ 10 min
- Dependency Management Without the ContainerFoundation≈ 10 min
- Business ValidationFoundation≈ 10 min
- Parse, Do Not ValidateFoundation≈ 10 min
- Choosing a Data Access LayerFoundation≈ 10 min
- What an ORM Actually DoesFoundation≈ 10 min
- Middleware Ordering Is a Correctness DecisionFoundation≈ 10 min
- Authentication in a BackendFoundation≈ 10 min
- Credentials and Password HandlingFoundation≈ 10 min
- Session AuthenticationFoundation≈ 10 min
- Token Authentication and the Revocation ProblemFoundation≈ 10 min
- Authorization in BackendsFoundation≈ 10 min
- Authentication vs AuthorizationFoundation≈ 10 min
- Where the Check BelongsFoundation≈ 10 min
- Role-Based Access ControlFoundation≈ 10 min
- Object-Level AuthorizationFoundation≈ 10 min
Transactions, queries, caches and other people's APIs0 of 20 lessons done
- Transactions from Application CodeFoundation≈ 10 min
- Where the Transaction Boundary GoesFoundation≈ 10 min
- One Transaction or TwoFoundation≈ 10 min
- External Calls Inside a TransactionFoundation≈ 10 min
- What an ORM Buys and What It CostsFoundation≈ 5 min
- The N+1 Query ProblemFoundation≈ 10 min
- Eager Loading and BatchingFoundation≈ 10 min
- Query BuildersFoundation≈ 10 min
- Raw SQL in Application CodeFoundation≈ 10 min
- Connection PoolsFoundation≈ 15 min
- Caching in BackendsFoundation≈ 10 min
- Cache-AsideFoundation≈ 10 min
- Cache InvalidationFoundation≈ 10 min
- TTL and ExpiryFoundation≈ 10 min
- When Not to CacheFoundation≈ 10 min
- Calling Something You Do Not ControlFoundation≈ 10 min
- TimeoutsFoundation≈ 15 min
- Serialization: Objects to BytesFoundation≈ 10 min
- Three Models, Not OneFoundation≈ 10 min
- Schema LeakageFoundation≈ 10 min
Work that outlives the request0 of 19 lessons done
- Request or Background?Intermediate≈ 10 min
- Background JobsIntermediate≈ 10 min
- Job QueuesIntermediate≈ 10 min
- Queue SemanticsIntermediate≈ 10 min
- Scheduled JobsIntermediate≈ 10 min
- Dead-Letter QueuesIntermediate≈ 10 min
- Commands vs EventsIntermediate≈ 10 min
- Event-Driven BackendsIntermediate≈ 10 min
- Naming EventsIntermediate≈ 10 min
- Writing Event ConsumersIntermediate≈ 10 min
- Inbound WebhooksIntermediate≈ 10 min
- Webhook Signature VerificationIntermediate≈ 10 min
- Outbound WebhooksIntermediate≈ 10 min
- Choosing an Upload PathIntermediate≈ 10 min
- File Uploads Through the BackendIntermediate≈ 10 min
- Presigned URLsIntermediate≈ 10 min
- Object StorageIntermediate≈ 10 min
- What Happens After the Bytes LandIntermediate≈ 15 min
- Serving FilesIntermediate≈ 10 min
Timeouts, retries, idempotency and limits0 of 20 lessons done
- RetriesIntermediate≈ 15 min
- Backoff and JitterIntermediate≈ 10 min
- Circuit BreakersIntermediate≈ 10 min
- BulkheadsIntermediate≈ 10 min
- Rate LimitingIntermediate≈ 10 min
- Rate Limit AlgorithmsIntermediate≈ 10 min
- Idempotency in BackendsIntermediate≈ 10 min
- Idempotency KeysIntermediate≈ 10 min
- The Idempotency Key FlowIntermediate≈ 15 min
- Idempotency StorageIntermediate≈ 15 min
- At-Least-Once DeliveryIntermediate≈ 10 min
- Duplicate DetectionIntermediate≈ 10 min
- Job IdempotencyIntermediate≈ 10 min
- Webhook IdempotencyIntermediate≈ 10 min
- Webhook Retries and OrderingIntermediate≈ 10 min
- Backend RacesIntermediate≈ 10 min
- Optimistic ConcurrencyIntermediate≈ 10 min
- Pessimistic LockingIntermediate≈ 15 min
- Atomic OperationsIntermediate≈ 10 min
- Resource LimitsIntermediate≈ 15 min
Observability, testing, security and performance work0 of 22 lessons done
- An Error Taxonomy That Maps Cause to ResponseIntermediate≈ 10 min
- Error Boundaries: Three Translations, Not OneIntermediate≈ 10 min
- Not Leaking Your InternalsIntermediate≈ 10 min
- Correlation Ids That Survive Every HopIntermediate≈ 10 min
- What a Backend Should Actually LogIntermediate≈ 10 min
- Structured LoggingIntermediate≈ 10 min
- The Metrics a Backend Must EmitIntermediate≈ 10 min
- Tracing From the Backend's SideIntermediate≈ 10 min
- Health Checks: Startup, Readiness, LivenessIntermediate≈ 10 min
- Configuration: Separating Code From EnvironmentIntermediate≈ 10 min
- Secrets Are Not ConfigurationIntermediate≈ 15 min
- Validate at Startup, Fail LoudlyIntermediate≈ 10 min
- A Test Strategy Chosen by What Each Layer Can ProveIntermediate≈ 10 min
- Test Against the Real DatabaseIntermediate≈ 10 min
- Contract Tests Between ServicesIntermediate≈ 10 min
- Performance Testing a BackendIntermediate≈ 10 min
- The Backend Security ChecklistIntermediate≈ 10 min
- SQL InjectionIntermediate≈ 10 min
- Command InjectionIntermediate≈ 10 min
- SSRF — When the Backend Fetches a URLIntermediate≈ 10 min
- Secrets in LogsIntermediate≈ 10 min
- What Serialization CostsIntermediate≈ 10 min
Scaling out and shipping without dropping requests0 of 20 lessons done
- Stateless ServicesAdvanced≈ 5 min
- Making an Existing Service StatelessAdvanced≈ 10 min
- Horizontal vs Vertical ScalingAdvanced≈ 10 min
- Load Balancing, From the Backend's SideAdvanced≈ 10 min
- Sticky SessionsAdvanced≈ 10 min
- Autoscaling a BackendAdvanced≈ 15 min
- Read Replicas From the ApplicationAdvanced≈ 10 min
- Pagination That Survives a Large TableAdvanced≈ 15 min
- Deployment ModelsAdvanced≈ 10 min
- Containerizing a BackendAdvanced≈ 10 min
- Graceful ShutdownAdvanced≈ 15 min
- Rolling DeploymentsAdvanced≈ 10 min
- Expand and Contract MigrationsAdvanced≈ 10 min
- Schema Migrations from the Application SideAdvanced≈ 10 min
- Running Two API Versions in One ServiceAdvanced≈ 10 min
- Mapping Services Across Cloud ProvidersAdvanced≈ 15 min
- Running a Backend on KubernetesAdvanced≈ 10 min
- Serverless BackendsAdvanced≈ 10 min
- Choosing a RuntimeAdvanced≈ 10 min
- Backend Runtime ModelsAdvanced≈ 15 min
Distributed patterns, failure handling and multi-tenancy0 of 21 lessons done
- The MonolithAdvanced≈ 10 min
- The Modular MonolithAdvanced≈ 10 min
- MicroservicesAdvanced≈ 10 min
- Comparing Backend ArchitecturesAdvanced≈ 10 min
- Synchronous vs Asynchronous CommunicationAdvanced≈ 10 min
- Failure PropagationAdvanced≈ 10 min
- Cascading FailureAdvanced≈ 10 min
- The Dual Write ProblemAdvanced≈ 10 min
- The Transactional OutboxAdvanced≈ 10 min
- Eventual Consistency in PracticeAdvanced≈ 10 min
- Keeping a Search Index in SyncAdvanced≈ 10 min
- Multi-TenancyAdvanced≈ 10 min
- Tenant IsolationAdvanced≈ 15 min
- Attribute-Based Access ControlAdvanced≈ 10 min
- BackpressureAdvanced≈ 10 min
- Worker ScalingAdvanced≈ 10 min
- Local vs Distributed CacheAdvanced≈ 10 min
- Cache StampedeAdvanced≈ 10 min
- Unbounded ConcurrencyAdvanced≈ 10 min
- Request CoalescingAdvanced≈ 10 min
- Deadlocks in Application CodeAdvanced≈ 15 min
Production backend engineering0 of 42 lessons done
- Debugging a Backend in ProductionAdvanced≈ 10 min
- Why Is My API Slow?Advanced≈ 10 min
- The Common Backend FailuresAdvanced≈ 10 min
- Backend Code SmellsAdvanced≈ 10 min
- Deploys Are the First SuspectAdvanced≈ 10 min
- Memory Leaks in Backend ServicesAdvanced≈ 10 min
- Retry StormsAdvanced≈ 10 min
- Connection Pool ExhaustionAdvanced≈ 10 min
- Queue BacklogAdvanced≈ 10 min
- Blocking the Event LoopAdvanced≈ 10 min
- The Node Event LoopAdvanced≈ 10 min
- Python Runtime ModelsAdvanced≈ 10 min
- Worker ProcessesAdvanced≈ 10 min
- C++ Backend ServicesAdvanced≈ 10 min
- Canary DeploymentsAdvanced≈ 10 min
- Blue-Green DeploymentsAdvanced≈ 10 min
- Feature Flags: Rollout, Kill Switches and DebtAdvanced≈ 10 min
- Defence in DepthAdvanced≈ 10 min
- Dependency SecurityAdvanced≈ 10 min
- Keep-Alive and Connection ReuseAdvanced≈ 10 min
- Accepting ConnectionsAdvanced≈ 10 min
- Parsing HTTPAdvanced≈ 10 min
- Deserialization: Bytes to ObjectsAdvanced≈ 10 min
- Every Input SurfaceAdvanced≈ 15 min
- Database ConstraintsAdvanced≈ 10 min
- When the Repository Is Just IndirectionAdvanced≈ 10 min
- Alternatives to LayeringAdvanced≈ 10 min
- What Belongs in the PipelineAdvanced≈ 10 min
- Request Context PropagationAdvanced≈ 15 min
- The Error BoundaryAdvanced≈ 10 min
- Authenticate First, or Rate-Limit First?Advanced≈ 15 min
- Where Sessions LiveAdvanced≈ 10 min
- OAuth and OIDC From the Backend SideAdvanced≈ 10 min
- API KeysAdvanced≈ 10 min
- Email and NotificationsAdvanced≈ 15 min
- Backend and Its NeighboursAdvanced≈ 5 min
- The Backend Reasoning LoopAdvanced≈ 5 min
- What an Agent Adds to a BackendAdvanced≈ 10 min
- A Tool Call Is a Backend CallAdvanced≈ 10 min
- Agent AuthorizationAdvanced≈ 10 min
- Budgets, Deadlines and Step LimitsAdvanced≈ 10 min
- Agent Audit LogsAdvanced≈ 10 min
How do I design, build, scale, secure, debug and operate the backend of a real production system?
Every lesson here starts from a requirement someone actually asked for, shows the implementation that comes to mind first, and then shows how that implementation behaves at 3 a.m. under load with a dependency degrading. The obvious build is obvious for a reason — it is also where production failures come from.
The order is the argument. What the contract promises decides what must be synchronous; what must be synchronous decides what belongs in a transaction; what is in a transaction decides what can safely be retried. Skip a step and you get a design that is locally reasonable and globally wrong.
This is the integration domain
Backend Engineering does not own the depth. It owns the point where the depth meets a running service that someone is paged for.
API Design decides the contract: the resource model, the status codes, the versioning story, what the caller is promised. That is a different question from this one.
This domain builds and runs the service behind that contract — the handler, the transaction, the pool, the queue, the retry, the deploy, the log line you will read during the incident.
Databases, Security, Performance, Cloud, OS & Networking and Computer Architecture each own a layer in full. Lessons here teach the application-side mechanism and hand the rest off by name.
Flagship experiences
The parts of this domain that are not reading.
POST /orders from the client through DNS, TLS, the proxy, the runtime, middleware, the router, authorization, the handler, the transaction, the queue and back. Every hop is a separate participant, and every one of them can fail on its own.
A real /checkout endpoint, step by step — with the hard question asked at each step before the answer is given. Where does the transaction end? What if payment times out? What if the commit succeeds and the publish does not?
Ten rungs, and each one appears only when a problem forces it. Read the problem first: a capability adopted without the problem that justifies it is cost with no benefit.
Inject a fault and read the signals. Several different faults raise p99, so p99 diagnoses nothing — the exercise is finding the signal that tells them apart.
The cross-domain spine: your handler, the driver, the socket, the syscall, the scheduler, the cache hierarchy, the core. You do not need this daily. You need it when the numbers stop making sense.
Where should this work run, what should it run on, and where does the data belong. Every leaf names what it buys and what it costs.
It was 100 ms and it is now 3 s. Work from the symptom to the cause through deploys, queries, pools, dependencies, the event loop and the queue.
Production situations with the cause unlabelled. Each one carries the trap — the wrong fix that looks right and makes the next incident worse.
What each question is really testing, what a strong answer sounds like, and the red flags that separate a remembered rule from a working model.
Learning modules
Twenty-eight modules, from what a backend actually is once the framework is removed to debugging one at 3 a.m.
What a backend actually is once the framework is removed: the request lifecycle end to end, which responsibilities belong to the server because they cannot be trusted to the client, and why every input from outside the process is untrusted.
What a server does between a socket and a response: accept, parse, build a request object, route, execute, serialize, write bytes. The part frameworks hide most completely.
Event loops, threads, workers and processes — the runtime model decides what "slow" means for your service. Taught as concurrency models rather than framework slogans.
How a method and a path become a function call, how precedence resolves ambiguity, and what a handler should and should not be responsible for.
The pipeline every request passes through, why its order is a correctness decision and not a style one, and how cross-cutting concerns compose without leaking into handlers.
Service layers, repositories and the transport/application/domain/infrastructure split — including when each is genuine structure and when it is ceremony that adds indirection without behaviour.
Three different validations that are routinely confused: is this well-formed, is this allowed by the business, and is this consistent with what the database already holds.
Turning runtime objects into bytes and back, what that costs in CPU and allocation, and why the database row is the wrong thing to hand a client.
Establishing who is calling: credentials, sessions, tokens, OAuth and API keys, from the backend's side of the problem rather than the protocol's.
Deciding what the caller may do — role-based, attribute-based, and the object-level check whose absence is the most common serious backend vulnerability there is.
ORM, query builder or raw SQL as an engineering decision with consequences, plus the query patterns and pool limits that decide how a backend behaves under load.
Which operations belong in one atomic unit, why a network call inside a transaction is a resource problem, and what to do when a commit and a message must both happen.
Cache-aside, invalidation, stampedes and the local-versus-distributed decision — including the cases where a cache adds a consistency problem and buys nothing.
Work that does not belong in the request path: deciding what to defer, the queue lifecycle from enqueue to dead-letter, and what happens when producers outrun consumers.
Commands ask for something to happen; events state that it did. What that distinction changes about coupling, naming, consumers and the consistency of everything downstream.
Every call leaving your process can be slow, wrong or absent. Timeouts, retries, backoff, circuit breakers, bulkheads and the rate limits you both enforce and obey.
Inbound HTTP you do not control: signature verification on the raw payload, duplicate delivery as the normal case, and ordering you cannot assume.
The property that makes retries safe. Keys, storage, scope and expiry — and the difference between a queue delivering once and your business logic acting once.
Two requests, one row. Optimistic versioning, pessimistic locks, atomic operations, and the bounded-resource thinking that keeps a burst from becoming an outage.
An error taxonomy that maps causes to responses, boundaries that stop internals leaking, and the logs, metrics and traces that let you answer questions you did not anticipate.
Uploads that do not go through your process, the bucket/key/object primitive underneath every provider's SDK, and what still has to happen after the bytes land.
What belongs in code versus runtime configuration, why secrets are a separate problem, and a test strategy chosen by what each layer can actually prove.
Shipping a running service without dropping requests: containers, graceful shutdown, health checks, rolling deploys and migrations that survive two versions at once.
Statelessness, load balancing, autoscaling signals, pagination, batching and streaming — the specific techniques, and the problem each one is a response to.
The checklist every service owes: injection, SSRF, dependency risk, secrets discipline and defence in depth, from the implementer's side rather than the attacker's.
Monolith, modular monolith, microservices and event-driven, compared honestly — with the distributed-systems costs that arrive the moment a function call becomes a network call.
The API was 100 ms and is now 3 s. Working from symptom to cause through deploys, queries, pools, dependencies, the event loop and the queue.
A model choosing a tool is a client choosing an endpoint. Authorization, budgets, timeouts and audit still belong to the backend, not to the prompt.
Reference
For when you already know roughly what you are looking for.
Nine stages in one order, each naming what it needs first and what you can build before moving on.
The searchable index: what a problem sounds like, and what to think when you hear it.
Ten pairs people genuinely confuse, with the confusion named.
The same primitive across AWS, GCP and Azure — and where the mapping misleads.