
Building a Load Balancer from Scratch on a $20 VPS
The journey to a million users begins with a simple load balancer If you’ve deployed a web app, you’ve already built the first 10% of a scalable system. The next 10% is learning what happens when one server isn’t enough, and what failure feels like in production. If you’ve never deployed a web app, start here: Reddit Guide In this post, I’ll recreate the "load balancer" chapter from Alex Xu’s System Design Interview on a $20 VPS, using Caddy as an L7 reverse proxy. The goal isn’t novelty, it’s building intuition for retries, health checks, and failover. Baseline Assumptions I had my portfolio site deployed on a Hetzner VPS. The app is a Tanstack Start app, but we are assuming you have something similar to the following: An app that runs in a container on port 3000. A CI process builds/pushes to GHCR. A server pulls latest via compose. Once you have an app that lives on a server somewhere, we are good to go. Load Balancing Now what if I post a cool project on Hacker News and it goes vir
Continue reading on Dev.to Webdev
Opens in a new tab




