Skip to content

feat(access-api): add configurable rate limiting to public API endpoints#66

Open
OlaGreat wants to merge 1 commit into
Adamantine-guild:mainfrom
OlaGreat:feature/rate-limiting-public-api
Open

feat(access-api): add configurable rate limiting to public API endpoints#66
OlaGreat wants to merge 1 commit into
Adamantine-guild:mainfrom
OlaGreat:feature/rate-limiting-public-api

Conversation

@OlaGreat

Copy link
Copy Markdown

Registers @fastify/rate-limit globally with per-route overrides:

  • Standard endpoints: 100 req/min per IP (configurable)
  • Expensive member listing endpoint: 20 req/min (stricter ceiling)
  • Health and metrics endpoints: exempt from rate limiting

All limits are driven by env vars (RATE_LIMIT_ENABLED, RATE_LIMIT_WINDOW_MS, RATE_LIMIT_DEFAULT_MAX, RATE_LIMIT_EXPENSIVE_MAX, REDIS_URL) with safe development defaults. Blocked requests receive a structured 429 body with a retryAfter field and standard x-ratelimit-* response headers.

Adds 8 tests covering allowed requests, 429 blocking, disabled mode, and health check exemption.

Closes #20

Registers @fastify/rate-limit globally with per-route overrides:
- Standard endpoints: 100 req/min per IP (configurable)
- Expensive member listing endpoint: 20 req/min (stricter ceiling)
- Health and metrics endpoints: exempt from rate limiting

All limits are driven by env vars (RATE_LIMIT_ENABLED, RATE_LIMIT_WINDOW_MS,
RATE_LIMIT_DEFAULT_MAX, RATE_LIMIT_EXPENSIVE_MAX, REDIS_URL) with safe
development defaults. Blocked requests receive a structured 429 body with
a retryAfter field and standard x-ratelimit-* response headers.

Adds 8 tests covering allowed requests, 429 blocking, disabled mode,
and health check exemption.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add rate limiting for public API routes

1 participant