Intermediate

Rate Limiting and API Gateways

Protect an API from abuse with a Redis-backed rate limiter that stays consistent across multiple server instances, understand fixed vs sliding window algorithms, and see where a dedicated API gateway fits in front of all of this.

~3h
0 / 7 steps
🚀
Intro

What you're building

Prerequisites: REST API Fundamentals with Node.js; Authentication and Session Management (for per-user limits); Redis running locally.

Targeted versions: express-rate-limit + rate-limit-redis (current major versions); verified against npmjs.com package pages, mid-2026.

You'll add rate limiting to your API that actually works once you run more than one instance of it — the naive in-memory approach silently breaks the moment you scale horizontally — and you'll see how the algorithm you choose changes what "too many requests" actually means at the boundary of a time window.

🔨

The in-memory limiter problem

🔨

Share state across instances with Redis

🔨

Limit by identity, not just IP

🔨

Fixed window vs sliding window

🎯
Secret Mission

Secret Mission: where a gateway takes over

🧹
Wrap Up

Before You Go

Pro

Test what you just learned

Self-testing is one of the best ways to retain new skills. Unlock project quizzes to check your understanding.

Log in to unlock