upstash-ratelimit-js

Implements Redis-backed rate limiting in TypeScript using the Upstash Ratelimit SDK.

2|1|Updated Jun 9, 2026
One-click install
npx skills add https://github.com/zester4/zilmate --skill upstash-ratelimit-js-zester4
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: upstash-ratelimit-js
Source: https://github.com/zester4/zilmate/tree/main/.agents/skills/upstash-ratelimit-js
Command: npx skills add https://github.com/zester4/zilmate --skill upstash-ratelimit-js-zester4

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires @upstash/ratelimit, @upstash/redis.

What problem does it solve? It guides developers through adding distributed rate limiting to TypeScript/JavaScript applications using the Upstash Ratelimit SDK, covering algorithm selection, cost implications, and abuse protection without guesswork. ## Core Features & Use Cases - Algorithm Guidance: Explains Fixed Window, Sliding Window, and Token Bucket algorithms with pitfalls and selection criteria for single-region and multi-region setups. - Full Method Reference: Documents limit, blockUntilReady, resetUsedTokens, getRemaining, and dynamic limit methods with edge-runtime handling of pending promises. - Cost & Protection Planning: Details Redis command costs per algorithm and feature, plus deny lists and automatic IP protection for traffic shaping. - Use Case: When building a serverless API on Vercel or Cloudflare, use this Skill to configure a sliding-window limiter with analytics and deny-list protection while estimating Redis command costs. ## Quick Start Ask the assistant to set up an Upstash sliding-window rate limiter in TypeScript that allows 10 requests per 10 seconds per user.

Frequently Asked Questions about upstash-ratelimit-js

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I set up rate limiting with Upstash Redis in TypeScript?

Install @upstash/ratelimit and @upstash/redis, create a Redis client with your URL and token, then instantiate a Ratelimit with an algorithm like Ratelimit.slidingWindow(10, "10 s"). Call limiter.limit(identifier) and check the success field to allow or reject requests.

Which rate limiting algorithm should I use: fixed window, sliding window, or token bucket?

Fixed window is cheapest but allows boundary bursts. Sliding window smooths boundaries but costs more Redis commands. Token bucket handles controlled bursts well but is not supported in multi-region setups.

Does Upstash Ratelimit work in serverless and edge runtimes?

Yes, but you must handle the pending promise returned by limit() using context.waitUntil(pending) so analytics and multi-region sync complete. Ephemeral caching also requires creating the cache outside the serverless handler.

How do I block malicious IPs with Upstash Ratelimit?

Set enableProtection: true and pass ip, userAgent, or country to limit(). The SDK supports manual deny lists and an automatic IP deny list refreshed daily from open-source abuse lists, with exact-match checking only.

Why is my rate limiter using more Redis commands than expected?

Sliding window is the most expensive algorithm, and features like deny lists, analytics, and dynamic limits each add commands per call. Multi-region setups multiply write commands by the number of read regions.