A simple custom implementation of a token bucket based rate limiter in Node.js and TypeScript for practice.
- Add key based rate limiting (ip, user, etc)
- Support distributed rate limiting using Redis
- Add implementations of other common algorithms: leaky bucket, sliding window counter, etc.
Install dependencies
npm installSet up .env file
PORT=8080
Run in development mode
npm run devCall endpoint protected with Rate Limiter
curl localhost:8080Run unit and end to end tests using Jest
npm run test