mcpField
U
upstash-ratelimit-js

upstash-ratelimit-js

github.com/upstashDevelopment3423.2k installsUpdated 1d ago
Repository

About upstash-ratelimit-js

A skills guide for developers integrating the `@upstash/ratelimit` TypeScript SDK with Redis. It covers setup, algorithms, configuration options, and guidance for limiting traffic and reducing abuse.

Key features

  1. 01Redis-backed rate limiting
  2. 02Rate-limiting algorithm guidance
  3. 03Prefixes and custom keys
  4. 04SDK methods and setup
  5. 05Traffic protection patterns

Use cases

  1. 01Limiting requests by user ID
  2. 02Shaping incoming traffic
  3. 03Reducing abusive requests

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/upstash/skills --skill upstash-ratelimit-js

After installing, type/upstash-ratelimit-jsin Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

algorithms.md
features.md
methods-getting-started.md
pricing-cost.md
traffic-protection.md

Details

From the project README

Rate Limit TS SDK

Bundled docs and source

Before writing or debugging SDK code, check node_modules/@upstash/ratelimit/docs/ for bundled docs and node_modules/@upstash/ratelimit/src/ for readable TypeScript source. Read and search the relevant files when present; otherwise use the references in this skill.

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 limiting for traffic shaping, abuse prevention, and protection patterns.

Comments

Markdown supported