Machine Room

Machine Room · 7 Nov 2026 · 27:02

The Entire Backend, Explained by Building One

Watch on YouTube

Authentication, databases, frameworks, payments, caching, queues, load balancing, containers, orchestration, the cloud, CI/CD and monitoring: every name on a backend job post exists because somebody's backend hit a problem. This episode builds one backend, from a single program and a text file up, walks into each problem in order and shows the tool that solves it, so the backend roadmap stops being a list of forty names.

One shoe shop, one developer. JWT so each customer can prove who they are. PostgreSQL when text files cannot remember. Express when you are rewriting what every framework already gives you. Stripe so card numbers never sit in your database. Redis when one page is read ten thousand times for every Buy. RabbitMQ when Buy takes six seconds. NGINX and twenty copies for the mega sale. Docker when it works on your machine and nowhere else. Kubernetes when twenty containers need a babysitter. AWS when you need forty machines for one weekend. GitHub Actions when a one-line fix has to reach forty copies. Prometheus and Grafana so you find out before the client does. The walls stay the same if your stack says Django, MySQL, Kafka or Azure.

This episode with chapters, full transcript and sources: https://themachineroom.dev/v/backend-grows/?utm_source=youtube&utm_medium=description&utm_campaign=backend-grows

Chapters

  1. 0:00The Roadmap, and a Client
  2. 2:40Who Is Pressing Buy? Authentication and JWT
  3. 4:36Remembering Everything: databases and PostgreSQL
  4. 6:23Writing Everything From Scratch: frameworks and Express
  5. 8:11The Money: payments with Stripe
  6. 10:00The Shop Gets Famous: caching with Redis
  7. 12:05Buy Takes Six Seconds: queues with RabbitMQ
  8. 14:35The Mega Sale: NGINX and load balancing
  9. 17:08Works on My Machine: containers and Docker
  10. 18:30Babysitting Twenty Containers: Kubernetes
  11. 19:54Where Do Forty Machines Come From? The cloud and AWS
  12. 21:20Shipping a Fix to Forty Copies: CI/CD with GitHub Actions
  13. 23:09The Client Finds Out First: Prometheus and Grafana
  14. 24:59The Roadmap, Re-read

Notes

solemates.com, Emma, the job post, the roadmap and every number in the shop's story are a made-up example. The tools are real, and the same job can be done by the others the video names at each step.

Sources

Get the next one by email

One email per video, with the sources. No newsletter padding, no selling the list. Leave any time.

Transcript

The narration, word for word, from the subtitle file that ships with the video.

0:00The Roadmap, and a Client

You have seen these names on job posts. By the end of this video, you will know what each one does, and why a backend needs it. Open any backend job post. Every one wants a different stack, and the list is long. You know two of them. The post says junior, but these are the requirements of a senior with ten years of experience. You open a roadmap to catch up and it is worse: forty names, arrows between them, and no answer to the only question you have. Which of these do I actually need. On day one, just one of them: the language you already know. Every other name on that list was built because somebody's backend hit a problem. Meet the problem and the name explains itself. So instead of reading the roadmap, we are going to build a backend, walk into every one of those problems one at a time, and see how each tool on the list solves one of them. Imagine a client comes to you. She is opening an online shoe shop, solemates.com. A frontend developer is doing the pages. The backend, everything that happens after a customer presses Buy, is handed to you. You start the way you started your first project. One small program in Python or JavaScript, running on your laptop, that saves each order into a text file. A customer presses Buy on a pair of running shoes, size 9, $60. The browser sends that as one request to your program. Your program reads the request, checks that size 9 is in stock, adds one line to the file, "order 1, running shoes, size 9, $60", and sends back "Order placed". That is a backend. It received a request, decided, remembered, responded. The set of requests your program accepts, like this Buy, is called its API. Ten orders a day, and this is enough. Nothing from the roadmap is here yet. Not one name, except the language you wrote it in. Each one arrives when the shop hits the wall it was built for, and the first wall comes with the first real customers.

2:40Who Is Pressing Buy? Authentication and JWT

Before the shop opens, there is a problem. There will be many customers, and every one of them must see their own orders and nobody else's. Your program cannot tell them apart. "Buy running shoes, size 9" arrives, and nothing in it proves who sent it. Anyone could send it in anyone's name. The fix is to make every customer prove who they are once, and then carry that proof on every request after. That is authentication, the first name from the roadmap. There are four common ways to do it: sessions, JWT, OAuth, and OpenID Connect. The last two are how 'Sign in with Google' works: Google does the sign-in for you. For our shop we use JWT. Here is how it works. Emma creates an account and signs in with her email and password. Your program checks them once and sends her browser a JWT token, signed by the shop so nobody can forge it. Her browser sends that token with every request from then on. The first thing your program does on each request is verify the signature. It matches, so this Buy is Emma's. No token, or a forged one, and the request is refused before anything else happens. With a session, the shop remembers who is signed in instead of the browser carrying a signed token. Either way, every request answers the same question. That is authentication. Not a wall of security. One question, asked before anything else on every request: who is this.

4:36Remembering Everything: databases and PostgreSQL

The shop opens and orders come in, and now the shop has to remember everything. Every customer, their password, their address, every product, every size, every order. All of that is going into text files, and text files are a very bad place for it. They have no structure, nothing links Emma to her orders, and finding anything means reading the whole thing. That is what a database is for. The common ones are PostgreSQL, MySQL, SQL Server and Oracle, which store data in tables, and MongoDB, which stores it as documents. For our shop we use PostgreSQL. Here is how it works. The shop's data becomes three tables: customers, products, orders. Emma's Buy becomes one row in orders: her customer ID, the product, size 9, $60, the time. "How many size 9s are left" becomes one query, answered in milliseconds. "Show Emma her orders" is another. The database finds the rows, your program never reads the whole thing. And the database can tie two changes together: add the order, and lower the stock count. That is called a transaction: either both changes happen, or neither does. A crash halfway never leaves a paid order with no stock taken. The database is where the shop remembers. The text files are gone.

6:23Writing Everything From Scratch: frameworks and Express

Step back and look at what you have written by hand so far. Code that reads a request off the network. Code that sends the answer back. Code that sends each request to the right place, Buy to the order code, Sign in to the login code. Checking the token. Connecting to the database. Hashing passwords. All of it is the backend: the part of the shop that runs on a server, that nobody sees. The frontend is the pages the frontend developer built, in Emma's browser. The backend is everything that happens after she presses a button. There are two ways to get those parts. Write them yourself, from scratch, which is what you have been doing. Or take them from a framework, where they are already written and tested, and build the backend faster. With a framework, you focus on the business logic, like checking that size 9 is in stock, and stop worrying about authentication and the rest. The framework reads the request, finds the right code, checks the token, hands you the data, and sends your answer back. Each language has its own. Spring Boot for Java, ASP.NET Core for C#, Express or NestJS for JavaScript, FastAPI or Django for Python. Our shop is in JavaScript, so we use Express. The language and the framework change from shop to shop. What the backend does never changes: receive, decide, remember, respond.

8:11The Money: payments with Stripe

Emma's order is a row in the database. Now the $60. Somebody has to take it from her card, and right now that somebody is your program. That means her card number arrives in your program and sits in your database. If the shop ever leaks, every customer's card leaks with it. And the card industry's rules say you may not hold card numbers unless you meet their security standard and pass its audits every year. You also cannot charge a card yourself. That takes a connection to the banks and the card networks, which no small shop has. So the shop does not touch money. A payment company does. The best-known payment companies are Stripe, PayPal, Adyen and Braintree. For our shop we use Stripe. Here is how it works. On the Buy page, Emma's browser sends her card number straight to Stripe, not to you. Stripe sends back a payment ID. Your program gets the payment ID and asks Stripe one thing: charge $60 on this. Stripe talks to the bank and answers yes or no. On yes, your program writes the order and stores the payment ID next to it. On no, nothing is written and Emma sees "payment declined". A refund later is one more question to Stripe with the same ID. Your program never sees a card number. The money runs through Stripe, the shop keeps only the receipt.

10:00The Shop Gets Famous: caching with Redis

The app works like a charm. A few customers, a few orders, the database answers everything in milliseconds. You are happy. Then the shop gets famous. Customers go from dozens to thousands, and what breaks is not the orders. It is the browsing. For every one Buy, the running shoes page is opened ten thousand times. Every open asks the database the same question: what is this shoe, what does it cost, which sizes are in stock. The same answer, ten thousand times, and the database is taking a huge toll on reads it has already answered. The fix is to keep the answer somewhere faster than the database and hand out copies. That is a cache. Redis and Memcached are the common ones. For our shop we use Redis. Here is how it works. Redis keeps data in memory, not on disk, so a read takes microseconds. The first time the running shoes page is asked for, your program asks the database, sends the answer to the browser, and stores a copy in Redis. That is a cache miss. The next ten thousand times, your program finds the copy in Redis and never touches the database. That is a cache hit. The database only sees the Buys. When Emma buys size 9, the stock changes, so your program updates the database and refreshes the copy in Redis. Stale copies are the one thing a cache can get wrong, and that one line is the whole fix. Redis is not where the shop remembers. The database still is. Redis holds a fast copy of whatever gets asked for most, so the database is only asked once.

12:05Buy Takes Six Seconds: queues with RabbitMQ

The shop has flourished, and a lot now happens when someone presses Buy. The client wants a confirmation email, the warehouse wants a pick list, the accounts team wants the sale recorded, and marketing wants it in their analytics. Your program does all of it, in order, before it answers. Save the order, send the email, call the warehouse system, update accounts, post to analytics. Then "Order placed". And that now takes six seconds. Six seconds is long enough for Emma to think the Buy did not work and press it again. Now she has two orders. And if the email service is down, the Buy fails with it, over an email. The fix is to answer Emma first and do the rest afterwards. Everything that can wait goes into a queue. The best-known queues are RabbitMQ, Kafka and Amazon SQS. For our shop we use RabbitMQ. Here is how it works. Emma presses Buy. Your program checks the token, charges the card, writes the order row, and then puts one message on the queue: "Emma's order is placed". Then it answers "Order placed". Half a second. And if Emma still presses twice, both presses carry the same one-time key from the Buy page, so your program places one order. That is called idempotency: the same request, sent twice, does the work once. Separate programs called workers watch the queue. The email worker takes the message and sends the confirmation. The warehouse worker takes it and creates the pick list. The analytics worker records the sale. Each one on its own, each in the background. If the email service is down, the message waits in the queue until it is back. Emma already has her confirmation. The Buy never depended on the email. That is why the page answers in half a second and the email arrives two minutes later. Buy does the must-do now and hands the rest to the queue.

14:35The Mega Sale: NGINX and load balancing

By now your program has long since moved off your laptop onto a server the client rents from a hosting company. One machine, running one copy of the program, and it has been enough. Then the client gets greedy. A mega sale, ads everywhere, one weekend. Ten thousand Buys a minute. One program on one machine cannot take that, however good the code is. At the peak, the machine's processor is at a hundred percent, requests pile up waiting for their turn, browsers time out, and solemates.com is down at the exact hour the client paid for. The fix is not a faster machine. It is more of them. The client rents nineteen more from the same hosting company, you run the same program as twenty copies on twenty machines, and they share the work. But Emma's browser only knows solemates.com, one address. It cannot pick a machine. So one thing stands behind that address, in front of all twenty, and takes every request: a reverse proxy. It is called a reverse proxy because it stands in for the servers: browsers talk only to it, and never see the twenty copies behind it. The best-known reverse proxies are NGINX and HAProxy, or you use the load balancer your cloud provides. For our shop we use NGINX. Here is how it works. Ten thousand requests a minute arrive at NGINX. It hands each one to whichever copy is free, in turn. Each copy sees five hundred requests a minute, which it can take easily. All twenty copies talk to the one database, the one Redis, the one RabbitMQ. The copies hold nothing themselves. That is why the JWT choice back at the login matters: a copy needs to remember nothing about Emma, so any copy can serve her next request. The sale weekend passes. The shop stayed up. From now on, every request enters through NGINX, and behind it the program is just copies: add more when traffic rises, remove them when it falls.

17:08Works on My Machine: containers and Docker

Twenty machines, and they are not the same. One has an older version of the language, one is missing a library, one has a setting nobody remembers changing. The program runs on nineteen and crashes on the twentieth. You spend a day finding out why, and the answer is the oldest sentence in software: it works on my machine. The fix is to stop installing the program on machines, and ship the machine's setup with the program. That is a container. Docker is the one everyone means. Podman is the other. For our shop we use Docker. Here is how it works. One file lists everything the program needs: the language and its version, every library, the settings. Docker builds that into an image, once. A container is that image running. Start the same image on all twenty machines and you have twenty identical copies, down to the last library. The twentieth machine stops being different, because the program no longer depends on the machine. It depends on the Docker image, and the image is the same for all twenty.

18:30Babysitting Twenty Containers: Kubernetes

Twenty identical containers on twenty machines, and they still need a person. One crashes at 2 AM and nobody restarts it until morning. The next sale needs forty, the week after needs five, and every start and stop is you, by hand, on a Sunday. The fix is to describe what should be running and let a program keep it that way. That is an orchestrator. Kubernetes is the one on every job post. Docker Swarm and Nomad are the smaller ones. For our shop we use Kubernetes. Here is how it works. You tell Kubernetes one thing: run twenty copies of this image. It spreads them across the machines and watches every one. If a container crashes at 2 AM, Kubernetes starts a new one in seconds, and you find out in the morning from a log, not a phone call. When the sale starts and the processors fill up, it adds copies. When the sale ends, it removes them. And it keeps NGINX's list of copies current, so requests never go to a container that is gone. Docker makes the copy. Kubernetes runs the copies.

19:54Where Do Forty Machines Come From? The cloud and AWS

Kubernetes can run forty copies, but forty copies need forty machines. The client rents twenty by the month, and they sat idle for the four weeks after the last sale. Renting forty for one weekend, and paying for the month, is madness. The fix is to rent by the hour. Somebody owns a building full of machines and lets you use as many as you need, for exactly as long as you need. That is the cloud. The best-known clouds are AWS, Microsoft Azure and Google Cloud. For our shop we use AWS. Here is how it works. You do not rent a machine for a month, you ask for one, and it is running in a minute. On Friday Kubernetes asks for forty. On Monday it gives thirty-five back, and you stop paying for them. And the cloud rents more than machines. The database, Redis and RabbitMQ each come as a service you switch on. They keep it running, backed up and patched, so you never run a database machine yourself. The client's twenty rented servers are gone. The shop now runs on machines nobody in the company has ever seen.

21:20Shipping a Fix to Forty Copies: CI/CD with GitHub Actions

The client finds a bug: the size dropdown shows size 9 twice. The fix is one line. Then it has to reach forty copies on forty rented machines, and the last time you did that by hand it took an afternoon and one copy was missed. Worse, a typo in that one line takes down all forty at once, and the shop with them. Shipping by hand is slow and dangerous in the same move. The fix is to make shipping a machine's job, all of it automated. Every change goes through the same steps, every time, with no person copying files. That is CI/CD. The best-known CI/CD tools are GitHub Actions, GitLab CI and Jenkins. For our shop we use GitHub Actions. Here is how it works. You push the one-line fix. CI, continuous integration, runs the tests automatically. If the typo breaks one, the pipeline stops and the fix never reaches the servers. If the tests pass, CD, continuous deployment, builds a new Docker image and tells Kubernetes to roll it out. A few copies at a time, the old ones kept running until the new ones answer requests. If a new copy does not answer, Kubernetes stops the rollout, and the old copies keep serving customers. So shipping a fix is now just one push. Twenty minutes later all forty copies are running it, and nobody copied a file.

23:09The Client Finds Out First: Prometheus and Grafana

Tuesday morning the client calls. Customers emailed overnight: solemates.com was slow for two hours around 3 AM, and some Buys failed. Nobody on your side knew. Forty copies, a database, Redis, RabbitMQ, NGINX, and from where you sat, every one of them looked fine. Finding out from customers is the worst way to find out. By then the damage is done and the cause is gone. The fix is to have every part report numbers all the time, and one screen that watches them. That is monitoring. The best-known monitoring tools are Prometheus with Grafana, Datadog and New Relic. For our shop we use Prometheus and Grafana. Here is how it works. Every copy, NGINX, the database and the queue each publish their numbers: requests per second, time per request, errors, queue length, processor load. Prometheus collects them every few seconds and keeps the history. Grafana draws them on one screen. And a rule watches the screen for you: if errors go above one percent for five minutes, or a request takes over two seconds, it alerts you. So this time you get the alert at 3:05 AM, hours before the client calls at 9. The 3 AM slowdown is on the graph, with the exact minute it started and the part that caused it. You fix it before the client wakes up, and she never finds out from a customer again.

24:59The Roadmap, Re-read

Back to the job post from the start. Node or Java, PostgreSQL, Redis, Docker, Kubernetes, Kafka, AWS, CI/CD. You now know every name on that line, and not as a definition. You know the day the website needed it. Open the roadmap again. Twelve names, twelve walls, in the order one shop hit them. Authentication when strangers arrived. A database when the files could not remember. A framework when you were writing the same parts as everyone else. Stripe when money came in. Redis when the shop got famous. A queue when Buy got slow. NGINX when one machine was not enough. Docker, Kubernetes, the cloud, CI/CD and monitoring when twenty copies had to stay alive. The names could have been different. Django instead of Express, MySQL instead of PostgreSQL, Kafka instead of RabbitMQ, Azure instead of AWS. The walls would be exactly the same, because the walls come from the shop, not from the tools. That is what the roadmap is. Not a list to learn top to bottom. A list of problems, written as the names of their solutions. So the next time it scares you, ask one question of each name: which wall is this. And then ask which wall you are at. If you are on day one, one program and a text file is a backend, and you need none of it yet. The job post still wants ten years of experience. You now have twelve answers. And if this helped, subscribe.