Skip to content

Add rate limiting for public API routes #20

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

GrantFox OSSGrantFox Open Source Sponsorship program tagMaybe RewardedIssue may qualify for a reward upon successful completion per campaign rulesOfficial CampaignCampaign: Official Campaign

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions