upstash-ratelimit-js
This skill guides you through implementing rate limiting with Upstash's Redis-backed TypeScript/JavaScript SDK. Learn to install the SDK, connect to Redis, create a rate limiter, and apply it to incoming requests using sliding window or other algorithms.
Upstash RateLimit JS helps you set up rate limiting for API requests using Redis and the TypeScript/JavaScript SDK.
AI-generated summary based on this skill's SKILL.md
Install
upstash/skills/upstash-ratelimit-js · repository language: JavaScript
git clone https://github.com/upstash/skills
cp -r skills/skills/upstash-ratelimit-js ~/.claude/skills/upstash-ratelimit-jsnpx skillfed install upstash/skills/upstash-ratelimit-jsFrequently asked questions
AI-generated answers based on this skill's SKILL.md and metadata
How do I set up rate limiting with Upstash Redis?
upstash-ratelimit-js guides you through installing the SDK, connecting to your Upstash Redis instance, and configuring a rate limiter. Start by installing the npm package, then initialize the Ratelimit client with your Redis URL and token. Choose your algorithm (sliding window is common), set request limits and time windows, and apply the limiter to your API endpoints to enforce traffic controls.
What rate limiter typescript example does upstash-ratelimit-js provide?
upstash-ratelimit-js offers code examples showing how to create a rate limiter in TypeScript, connect it to Upstash Redis, and apply it to incoming requests. Examples demonstrate sliding window algorithms, configuring request thresholds and time intervals, and integrating the limiter into Node.js/TypeScript applications to throttle user requests and prevent abuse.
Which rate limiting algorithms does upstash-ratelimit-js support?
upstash-ratelimit-js helps you learn and choose from multiple rate limiting algorithms suited to different use cases. The skill covers sliding window and other approaches, explaining how each algorithm works, their trade-offs, and when to apply them. This lets you select the right strategy for your traffic protection and abuse prevention needs.
How can I prevent API abuse and implement traffic protection?
upstash-ratelimit-js enables you to implement traffic protection by setting up rate limiting on your API endpoints using Upstash Redis. Configure request limits per user or IP, apply the limiter to incoming requests, and reject or throttle requests exceeding your thresholds. This prevents abuse, protects your backend, and ensures fair resource allocation.
Is upstash-ratelimit-js suitable for Node.js applications?
Yes, upstash-ratelimit-js is designed for Node.js and TypeScript environments. The skill provides quick start guides, code examples, and configuration instructions for implementing rate limiting in Node.js applications. It covers connecting to Upstash Redis, creating rate limiters, and integrating them into your request handling pipeline.
What is the license for the upstash-ratelimit-js package?
upstash-ratelimit-js is released under the MIT license, allowing free use, modification, and distribution in both open-source and commercial projects with minimal restrictions.
SKILL.md
rendered from the published skill — quoted content, verbatim
Rate Limit TS SDK
Quick Start
- Install the SDK and connect to Redis.
- Create a rate limiter and apply it to incoming operations.
Example:
import { Ratelimit } from "@upstash/ratelimit";
import { Redis } from "@upstash/redis";
const redis = new Redis({ url: "<url>", token: "<token>" });
const limiter = new Ratelimit({ redis, limiter: Ratelimit.slidingWindow(5, "10s") });
const { success } = await limiter.limit("user-id");
if (!success) {
// throttled
}
Other Skill Files
- algorithms.md: Describes all available rate‑limiting algorithms and how they behave.
- pricing-cost.md: Explains pricing, Redis cost implications, and operational considerations.
- features.md: Lists SDK features such as prefixes, custom keys, and behavioral options.
- methods-getting-started.md: Full method reference for the SDK's API and getting started guide.
- traffic-protection.md: Guidance on applying rate
(truncated - see the full file via the links below)
Read as markdown · JSON record · Browse the source repository
File tree — 6 files
skills/upstash-ratelimit-js/SKILL.md
skills/upstash-ratelimit-js/algorithms.md
skills/upstash-ratelimit-js/features.md
skills/upstash-ratelimit-js/methods-getting-started.md
skills/upstash-ratelimit-js/pricing-cost.md
skills/upstash-ratelimit-js/traffic-protection.md