Skip to content

Add rate limiting for public API routes #20

@Lakes41

Description

@Lakes41

Summary

Protect public API endpoints from accidental overload and basic abuse by adding configurable rate limiting.

Current Behaviour

The API exposes public routes for membership lookup, profile lookup, access checks, and member listing without visible request throttling.

Expected Behaviour

The API should limit repeated requests by IP address or configured client identifier while preserving normal SDK and frontend usage.

Suggested Implementation

Add Fastify-compatible rate limiting with configurable limits per route group. Use stricter limits for expensive endpoints such as community member listing and more permissive limits for lightweight health checks. Make Redis-backed storage optional if the project already runs Redis in deployment.

Files or Areas Likely Affected

  • apps/access-api/src/app.ts
  • apps/access-api/src/index.ts
  • apps/access-api/src/routes.ts
  • apps/access-api/src/config.ts
  • .env.example
  • README.md

Acceptance Criteria

  • Rate limiting can be configured through environment variables
  • Health checks are excluded or given a separate safe limit
  • Expensive public endpoints have bounded request rates
  • Rate-limit responses return a clear HTTP status and message
  • Tests cover allowed requests, blocked requests, and disabled rate limiting
  • Documentation explains how to tune limits for local and production environments

Additional Notes

Avoid hard-coding production limits. Defaults should be safe for local development and easy to override.

Metadata

Metadata

Assignees

Labels

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

Type

No type
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