Skip to content

API Rate Limiting Middleware with Token Bucket and Per-Endpoint Tiers #77

Description

@JamesEjembi

Problem Statement

Public API endpoints lack rate limiting, allowing abusive clients to degrade service for others. Implement configurable rate limiting middleware with per-endpoint tiers and burst handling.

Technical Bounds

  • Algorithm: token bucket with configurable refill rate
  • Storage: in-memory with optional Redis backend
  • Tiers: free (10 req/min), pro (100 req/min), enterprise (1000 req/min)
  • Burst: 2x sustained rate for up to 10 seconds
  • Response: 429 with Retry-After header

Steps

  1. Implement token bucket rate limiter
  2. Create middleware with per-endpoint tier config
  3. Add Redis backend for distributed rate limiting
  4. Write tests for burst, cooldown, and edge cases

Metadata

Metadata

Assignees

Labels

GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardOfficial CampaignCampaign: Official Campaign

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions