Skip to content

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

Merged
Lakes41 merged 2 commits into
Adamantine-guild:mainfrom
OlaGreat:feature/rate-limiting-public-api
Jun 29, 2026
Merged

feat(access-api): add configurable rate limiting to public API endpoints#66
Lakes41 merged 2 commits into
Adamantine-guild:mainfrom
OlaGreat:feature/rate-limiting-public-api

Conversation

@OlaGreat

Copy link
Copy Markdown
Contributor

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.

@Lakes41 Lakes41 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good Job @OlaGreat
But do resolve pipeline failure

@Lakes41
Lakes41 dismissed their stale review June 29, 2026 09:39

Nevermind

@Lakes41
Lakes41 merged commit abb4198 into Adamantine-guild:main Jun 29, 2026
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

2 participants