# 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](/redis/sdks/ratelimit-ts/gettingstarted)
- [Costs](/redis/sdks/ratelimit-ts/costs)

## Features

<CardGroup cols={2}>
  <Card
    title="Caching"
    icon="shield-halved"
    href="/redis/sdks/ratelimit-ts/features#caching"
  >
    Handle blocked requests without having to call your Redis Database
  </Card>
  <Card
    title="Timeout"
    icon="stopwatch"
    href="/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>
  <Card
    title="Analytics & Dashboard"
    icon="magnifying-glass-chart"
    href="/redis/sdks/ratelimit-ts/features#analytics-and-dashboard"
  >
    Collect information on which identifiers made how many requests and how many
    were blocked
  </Card>
  <Card
    title="Traffic Protection"
    icon="lock"
    href="/redis/sdks/ratelimit-ts/traffic-protection"
  >
    Create a deny list to block requests based on user agents, countries, IP
    addresses and more
  </Card>
  <Card
    title="Custom Rates"
    icon="chart-simple"
    href="/redis/sdks/ratelimit-ts/features#custom-rates"
  >
    Consume different amounts of tokens in different requests (example: limiting
    based on request/response size)
  </Card>
  <Card
    title="Multi Region"
    icon="globe"
    href="/redis/sdks/ratelimit-ts/features#multi-region"
  >
    Utilize several Redis databases in different regions to serve users faster
  </Card>
  <Card
    title="Multiple Limits"
    icon="gears"
    href="/redis/sdks/ratelimit-ts/features#using-multiple-limits"
  >
    Use different limits for different kinds of requests (example: paid and free
    users)
  </Card>
  <Card
    title="Dynamic Limits"
    icon="sliders"
    href="/redis/sdks/ratelimit-ts/features#dynamic-limits"
  >
    Change rate limits at runtime without recreating the rate limiter instance
  </Card>
</CardGroup>

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

## Examples

<CardGroup cols={2}>
  <Card
    title="Nextjs"
    href="https://github.com/upstash/ratelimit/tree/main/examples/nextjs"
  >
    Rate limit an API in a Nextjs project
  </Card>
  <Card
    title="Nextjs with Middleware"
    href="https://github.com/upstash/ratelimit/tree/main/examples/nextjs-middleware"
  >
    Rate limit an API with a Middleware in a Nextjs project
  </Card>
  <Card
    title="Vercel Edge"
    href="https://github.com/upstash/ratelimit/tree/main/examples/vercel-edge"
  >
    Rate limit an Vercel Edge Function
  </Card>
  <Card
    title="Enabling Protection"
    href="https://github.com/upstash/ratelimit/tree/main/examples/enable-protection"
  >
    Use Deny Lists to Protect Your Website
  </Card>
  <Card
    title="Cloudflare Pages"
    href="https://github.com/upstash/ratelimit/tree/main/examples/cloudflare-pages"
  >
    Rate limit access to your Cloudflare Pages app
  </Card>
  <Card
    title="Cloudflare Workers"
    href="https://github.com/upstash/ratelimit/tree/main/examples/cloudflare-workers"
  >
    Rate limit access to your Cloudflare Workers
  </Card>
  <Card
    title="Remix"
    href="https://github.com/upstash/ratelimit/tree/main/examples/remix"
  >
    Rate limit access to a Remix App
  </Card>
  <Card
    title="Rate limit using Vercel KV"
    href="https://github.com/upstash/ratelimit/tree/main/examples/with-vercel-kv"
  >
    Rate limit a Nexjs app using Vercel KV
  </Card>
  <Card
    title="Deno App"
    href="https://github.com/upstash/ratelimit/tree/main/examples/deno"
  >
    Rate limit your deno app
  </Card>
  <Card
    title="Rate limit your Chatbot"
    href="https://upstash.com/blog/degree-guru#rate-limiting"
  >
    Limiting requests to a Chatbot endpoint which streams LLM outputs
  </Card>
</CardGroup>
