library · inferred from evidence
@upstash/ratelimit
A library for implementing traffic protection and rate limiting.
- Traffic protection rollout: enableProtection, request context, dashboard deny lists
Roll out traffic protection: enableProtection, feed IP and country into limit(), manage deny lists from the dashboard.
- Ratelimit analytics you can trust: analytics flag, pending promise, dashboard
Ratelimit analytics that you can trust: analytics true, pending awaited, and the dashboard as your source of truth.
- Multi-region rate limiting: MultiRegionRatelimit with fixed window, or one global database
MultiRegionRatelimit for global rate limits: one limiter over several regional Redis databases, with fixed window to keep costs sane.
- Ratelimit analytics undercounting: the dropped pending promise on serverless
Ratelimit analytics undercount when the pending promise is dropped on serverless. Analytics writes happen after limit() returns.
- upstash/redis on Cloudflare Workers: the cloudflare import, wrangler secrets, fromEnv(env)
Use the cloudflare entrypoint of @upstash/redis, store credentials with wrangler secret put, and pass env to fromEnv in module workers.