Mini API Gateway
1 minute read •
I kept hearing about API gateways but never really understood what was going on inside one, so I decided to build a small one myself.
The gateway takes requests through /proxy, checks the x-api-key header and uses Redis to rate limit each caller. Each key gets 5 requests per minute, with the 6th returning a 429. Requests that pass the filter are then forwarded to the upstream service.
The part I found most interesting was using Redis expiry to handle the rate limit automatically instead of having to manage the counters myself.
It is still a small project with one route and one upstream, but it gave me a much better understanding of how API gateways and rate limiting work.
Built with: Java 21, Spring Boot, Redis, Maven