TypeScriptadvanceddevopsAI generated

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

  1. 01

    Design the middleware configuration API

    ~1.5h

    Define a typed configuration interface for limit strategy, window size, and per-route overrides.

  2. 02

    Implement the token-bucket algorithm

    ~2.5h

    Implement a Redis-backed token-bucket rate limiter using atomic Lua scripts.

  3. 03

    Implement the sliding-window algorithm

    ~2.5h

    Implement a sliding-window counter as an alternative strategy, also backed by Redis.

  4. 04

    Integrate into a sample API

    ~1.5h

    Apply the middleware to a sample Express API with different limits per route.

  5. 05

    Write a load-testing script

    ~2.5h

    Simulate concurrent clients hitting the API across multiple server instances sharing Redis.

  6. 06

    Add rejection metrics logging

    ~1.5h

    Log and report metrics on rejected requests for observability.

Ready to build this?

Get a GitHub repo and start building. Your AI reviewer checks each step as you go.

~12h · 6 steps

Tech stack

ExpressRedisioredis