🔮 Future Additions
- Sliding Window Log algorithm
- Load balancing layer
- API Keys & RBAC (Redis-only possible)
- Middleware-level caching
-
Gateway features:
- rate limiting
- authentication
-
load balancingload balancing - circuit breaking
- Prometheus/Grafana dashboards
- Distributed tracing (OpenTelemetry)
🧩 Architecture Overview
Client → API Gateway (future) → Rate Limiter Service → Redis / Redis Cluster
markdown Copy code
- Each algorithm uses:
- Dedicated Redis keys
- Atomic Lua scripts
- Isolated logic for dashboard comparison
🔥 API Endpoints
POST /api/limiter/test → Fixed Window
POST /api/limiter/sliding → Sliding Window
POST /api/limiter/tokenbucket → Token Bucket
POST /api/limiter/leakybucket → Leaky Bucket
POST /api/limiter/all → Run all algorithms together
-
POST /api/limiter/test→ Fixed Window -
POST /api/limiter/sliding→ Sliding Window -
POST /api/limiter/tokenbucket→ Token Bucket -
POST /api/limiter/leakybucket→ Leaky Bucket -
POST /api/limiter/all→ Run all algorithms together
📦 Example Response
{
"activeKeys": 1,
"response": { ... },
"blockedRequests": 27,
"allowedRequests": 67,
"totalRequests": 94
}
🐳 Setup & Installation
bash
Copy code
git clone [<repo-url>](https://github.com/Anshikakalpana/rate-limiter)
docker compose up --build
Starts: Redis Cluster, Node server, Lua scripts
🧪 Testing & Load Scenarios
Test bursts, allowed vs blocked, algorithm comparison via /metrics
Tools: Postman Runner, k6, Artillery, JMeter
📬 Postman Collection
[ Postman collection to test all endpoints:](https://app.getpostman.com/join-team?invite_code=13841166f45640e9b8c8e3a36a9cfc49afed7ac4d4cf1a0be867b7b82d1d0ed8&target_code=bc4d4f0c1c320a256972bc868580defb)
Open Postman Collection
🧭 Roadmap
Sliding Window Log algorithm
API Keys & RBAC (Redis-only)
Middleware caching
Load balancing
Circuit breaking
📄 License
MIT License — free for personal & commercial use.{
"activeKeys": 1,
"response": { ... },
"blockedRequests": 27,
"allowedRequests": 67,
"totalRequests": 94
}
0 commit comments