05 · Infrastructure · reverse proxy
FluxGate
A reverse proxy and load balancer written from scratch on Node's http module, to understand what NGINX or an ALB does underneath.
Problem
I use reverse proxies daily and wanted to know what is inside one: streaming, balancing, health checking and rate limiting, built without a framework doing the work.
What I built
- A streaming reverse proxy that pipes requests and responses without buffering them.
- Round-robin load balancing across three backend services that skips unhealthy nodes.
- Periodic health checks that mark backends up or down and bring them back when they recover.
- Redis-backed rate limiting at 10 requests per 10 seconds per IP, with TTL-based reset.
- A metrics endpoint exposing request counts, errors, active connections and backend health.
- Proxy, backends and Redis run as containers on a private Docker network.
Architecture
Client
FluxGate
rate limit, metrics
Health-aware round robin
Backend x3
Engineering decisions
- Stream, do not buffer
- Bodies are piped through, which keeps memory flat regardless of payload size.
- Shared rate-limit state
- Counters live in Redis, so limits would still hold if more than one proxy instance ran.
- Failover without intervention
- Health checks drive routing, so a dead backend drops out of rotation and returns on its own.
Technology
- Node.js
- Redis
- Docker
- Docker Compose
- HTTP
Result
A learning project that made proxying, health checking and rate limiting concrete instead of something I only configure.