Skip to content

feat: customize rate limit per endpoint#1293

Open
Bellamzy wants to merge 1 commit into
Web3Novalabs:mainfrom
Bellamzy:feature/per-endpoint-rate-limiting
Open

feat: customize rate limit per endpoint#1293
Bellamzy wants to merge 1 commit into
Web3Novalabs:mainfrom
Bellamzy:feature/per-endpoint-rate-limiting

Conversation

@Bellamzy

Copy link
Copy Markdown

Here's a PR description you can use:

───────────────────────────────────────────────────────────────────────────────────────────────

feat: customize rate limit per endpoint

Replaces the single global rate limit with per-route tiers so different endpoint groups can be
throttled independently.

Changes:

  • constants.rs — added four tier constants (burst + period) for Light, Read, User, and Write
    tiers
  • rate_limit.rs (new) — RateLimitTier enum and with_rate_limit(router, tier) helper; no-op in
    test builds to prevent test cross-contamination
  • routes/v1.rs — router() splits routes into four sub-routers, each wrapped with its tier
  • server.rs — removed duplicate global GovernorLayer (rate limiting now owned by sub-routers)
  • lib.rs — registered pub mod rate_limit

Tier breakdown:

┌───────┬────────────────────────────────────────────┬────────────────┐
│ Tier │ Endpoints │ Limit │
├───────┼────────────────────────────────────────────┼────────────────┤
│ Light │ /, /health, /fees, /prices, /ws │ 120 req / 60 s │
├───────┼────────────────────────────────────────────┼────────────────┤
│ Read │ /pools, /stats, /leaderboard, /referrals/* │ 60 req / 60 s │
├───────┼────────────────────────────────────────────┼────────────────┤
│ User │ /users/{address}/* │ 30 req / 60 s │
├───────┼────────────────────────────────────────────┼────────────────┤
│ Write │ /indexer/* │ 20 req / 60 s │
└───────┴────────────────────────────────────────────┴────────────────┘
closes #1146

@vercel

vercel Bot commented Jun 28, 2026

Copy link
Copy Markdown

@Bellamzy is attempting to deploy a commit to the shola's projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave

drips-wave Bot commented Jun 28, 2026

Copy link
Copy Markdown

@Bellamzy Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

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.

feat(backend): customize route rate limit per endpoint

1 participant