---
title: "Ratelimit with Upstash Redis"
description: "Ratelimit your applications with Upstash’s Redis and Ratelimit"
url: "https://vercel.com/templates/next.js/ratelimit-with-upstash-redis"
links:
  repository: "https://github.com/upstash/examples/tree/main/examples/ratelimit-with-redis"
  demo: "https://ratelimit-with-upstash.vercel.app/"
  deploy: "https://vercel.com/new/clone?demo-title=Ratelimit+with+Upstash+Redis&demo-description=Ratelimit+your+applications+with+Upstash%E2%80%99s+Redis+and+Ratelimit&demo-url=https%3A%2F%2Fratelimit-with-upstash.vercel.app%2F&demo-image=%2F%2Fimages.ctfassets.net%2Fe5382hct74si%2F5BOMxJPXdkntcfbFaOBF3p%2F1422c05836ed02199b931dbe80c6823d%2Flanding-page.png&project-name=Ratelimit+with+Upstash+Redis&repository-name=ratelimit-with-upstash-redis&repository-url=https%3A%2F%2Fgithub.com%2Fupstash%2Fexamples%2Ftree%2Fmain%2Fexamples%2Fratelimit-with-redis&from=templates&skippable-integrations=1&stores=%5B%7B%22type%22%3A%22integration%22%2C%22protocol%22%3A%22storage%22%2C%22productSlug%22%3A%22upstash-kv%22%2C%22integrationSlug%22%3A%22upstash%22%7D%5D"
---

# Ratelimit with Upstash Redis

Ratelimit your applications with Upstash’s Redis and Ratelimit

# @upstash/ratelimit & @upstash/redis example

This example demonstrates using @upstash/ratelimit with Upstash Redis.

## Local Development

Copy the example env file:

```
cp .env.local.example .env.local
```

Set the environment variables in the new env file after creating an Upstash Redis instance.

Then, install the dependencies:

```
npm install
```

Finally, run the application with

```
npm run dev
```

## Deploy to Vercel

To deploy to vercel, simply run

```
vercel
```

If you create a new project, you may need to set the environment variables and redeploy the app.

## Related Templates

### [Vercel Edge Middleware Rate Limit](https://vercel.com/templates/other/middleware-rate-limit)

Add rate limiting to your application with any frontend framework.

### [Rate Limit API Requests Firewall Rule](https://vercel.com/templates/other/rate-limit-api-requests-firewall-rule)

Adds a rule to your Vercel Firewall that rate limits API requests.

---

## Additional documentation

The [Vercel Knowledge Base](https://vercel.com/kb) contains guides and answers to common questions about Vercel, including deployment, framework configuration, domains, caching, and troubleshooting.
