> ## Documentation Index
> Fetch the complete documentation index at: https://upstash.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Ratelimit TypeScript SDK Overview

# Upstash Rate Limit

[![npm (scoped)](https://img.shields.io/npm/v/@upstash/ratelimit)](https://www.npmjs.com/package/@upstash/ratelimit)

It is the only connectionless (HTTP based) rate limiting library and designed
for:

* Serverless functions (AWS Lambda, Vercel ...)
* Cloudflare Workers
* Vercel Edge
* Fastly Compute\@Edge
* Next.js, Jamstack ...
* Client side web/mobile applications
* WebAssembly
* and other environments where HTTP is preferred over TCP.

## Quick Links:

* [Github Repository](https://github.com/upstash/ratelimit)
* [Getting Started](https://upstash.com/docs/redis/sdks/ratelimit-ts/gettingstarted)
* [Costs](https://upstash.com/docs/redis/sdks/ratelimit-ts/costs)

## Features

> [card] [Caching](https://upstash.com/docs/redis/sdks/ratelimit-ts/features#caching)
>
> Handle blocked requests without having to call your Redis Database

> [card] [Timeout](https://upstash.com/docs/redis/sdks/ratelimit-ts/features#timeout)
>
> If the Redis call of the ratelimit is not resolved in some timeframe, allow
> the request by default

> [card] [Analytics & Dashboard](https://upstash.com/docs/redis/sdks/ratelimit-ts/features#analytics-&-dashboard)
>
> Collect information on which identifiers made how many requests and how many
> were blocked

> [card] [Traffic Protection](https://upstash.com/docs/redis/sdks/ratelimit-ts/traffic-protection)
>
> Create a deny list to block requests based on user agents, countries, IP
> addresses and more

> [card] [Custom Rates](https://upstash.com/docs/redis/sdks/ratelimit-ts/features#custom-rates)
>
> Consume different amounts of tokens in different requests (example: limiting
> based on request/response size)

> [card] [Multi Region](https://upstash.com/docs/redis/sdks/ratelimit-ts/features#multi-region)
>
> Utilize several Redis databases in different regions to serve users faster

> [card] [Multiple Limits](https://upstash.com/docs/redis/sdks/ratelimit-ts/features#using-multiple-limits)
>
> Use different limits for different kinds of requests (example: paid and free
> users)

> [card] [Dynamic Limits](https://upstash.com/docs/redis/sdks/ratelimit-ts/features#dynamic-limits)
>
> Change rate limits at runtime without recreating the rate limiter instance

For more information about the features, see the [Features tab](https://upstash.com/docs/redis/sdks/ratelimit-ts/features).

## Examples

> [card] [Nextjs](https://github.com/upstash/ratelimit/tree/main/examples/nextjs)
>
> Rate limit an API in a Nextjs project

> [card] [Nextjs with Middleware](https://github.com/upstash/ratelimit/tree/main/examples/nextjs-middleware)
>
> Rate limit an API with a Middleware in a Nextjs project

> [card] [Vercel Edge](https://github.com/upstash/ratelimit/tree/main/examples/vercel-edge)
>
> Rate limit an Vercel Edge Function

> [card] [Enabling Protection](https://github.com/upstash/ratelimit/tree/main/examples/enable-protection)
>
> Use Deny Lists to Protect Your Website

> [card] [Cloudflare Pages](https://github.com/upstash/ratelimit/tree/main/examples/cloudflare-pages)
>
> Rate limit access to your Cloudflare Pages app

> [card] [Cloudflare Workers](https://github.com/upstash/ratelimit/tree/main/examples/cloudflare-workers)
>
> Rate limit access to your Cloudflare Workers

> [card] [Remix](https://github.com/upstash/ratelimit/tree/main/examples/remix)
>
> Rate limit access to a Remix App

> [card] [Rate limit using Vercel KV](https://github.com/upstash/ratelimit/tree/main/examples/with-vercel-kv)
>
> Rate limit a Nexjs app using Vercel KV

> [card] [Deno App](https://github.com/upstash/ratelimit/tree/main/examples/deno)
>
> Rate limit your deno app

> [card] [Rate limit your Chatbot](https://upstash.com/blog/degree-guru#rate-limiting)
>
> Limiting requests to a Chatbot endpoint which streams LLM outputs


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.