ratelimit-ts

Implement Upstash ratelimit-ts rate limits against a Redis backend.

2.0k|50|Updated Apr 20, 2022
One-click install
npx skills add https://github.com/upstash/ratelimit-js --skill ratelimit-ts
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ratelimit-ts
Source: https://github.com/upstash/ratelimit-js/tree/main/skills
Command: npx skills add https://github.com/upstash/ratelimit-js --skill ratelimit-ts

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill provides concise guidance for integrating the Upstash rate limiter TypeScript SDK, covering setup, usage, and best practices.

Core Features & Use Cases

  • Covers SDK installation, limiter construction, and common patterns like slidingWindow, fixedWindow, and tokenBucket; applicable to APIs, serverless apps, and edge runtimes.
  • Example: Demonstrates creating a limiter and applying it to an identifier in a typical API flow.

Quick Start

Install the ratelimit-ts SDK, connect to Redis, and perform a simple rate-limit check for a given identifier.

Frequently Asked Questions about ratelimit-ts

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

FAQPage Schema
How do I set up rate limiting in a serverless TypeScript API using Redis?

You can implement rate limiting by installing the ratelimit-ts SDK, connecting it to Redis, and applying a limiter check to request identifiers. This guides configuration for APIs, serverless apps, and edge runtimes.

What is the difference between sliding window and fixed window rate limiting algorithms?

Sliding window rate limiting calculates request limits over a continuously moving time period for smoother traffic, while fixed window resets limits at strict intervals. The SDK provides configuration patterns for both slidingWindow and fixedWindow algorithms.

Can I use Upstash rate limiting with edge runtimes?

Yes, Upstash rate limiting works with edge runtimes. The SDK explicitly supports applying rate limits against a Redis backend across serverless functions, edge runtimes, and traditional applications.

How do I implement a token bucket rate limit for dynamic API thresholds?

You implement a token bucket rate limit for dynamic API thresholds by using the tokenBucket pattern provided by the ratelimit-ts SDK. This manages burst traffic while enforcing dynamic limits based on request identifiers.

Does Redis rate limiting support multi-region deployments?

Redis rate limiting supports multi-region deployments. The SDK includes specific guidance and multi-region considerations for implementing rate limits across distributed architectures.