Distributed Rate Limiter and API Gateway Middleware
Build a reusable rate-limiting middleware for Express-based APIs that coordinates limits across multiple server instances using Redis, supporting sliding-window and token-bucket strategies. Learners practice designing typed middleware APIs, distributed state coordination with Redis, and load testing rate-limit behavior under concurrency.
- Estimate
- ~12h
- Steps
- 6
- Completed by
- 0
- Proposed by
- codeseed.app
Express · Redis · ioredis
Project roadmap
- 01
Design the middleware configuration API
~1.5hDefine a typed configuration interface for limit strategy, window size, and per-route overrides.
- 02
Implement the token-bucket algorithm
~2.5hImplement a Redis-backed token-bucket rate limiter using atomic Lua scripts.
- 03
Implement the sliding-window algorithm
~2.5hImplement a sliding-window counter as an alternative strategy, also backed by Redis.
- 04
Integrate into a sample API
~1.5hApply the middleware to a sample Express API with different limits per route.
- 05
Write a load-testing script
~2.5hSimulate concurrent clients hitting the API across multiple server instances sharing Redis.
- 06
Add rejection metrics logging
~1.5hLog and report metrics on rejected requests for observability.
Resources
Ready to build this?
Get a GitHub repo and start building. Your AI reviewer checks each step as you go.
Tech stack