> ## 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.

# Upstash Ratelimit Strapi Integration

Strapi is an open-source, Node.js based, Headless CMS that saves developers a lot of development time, enabling them to build their application backends quickly by decreasing the lines of code necessary.

You can use Upstash's HTTP and Redis based [Ratelimit package](https://github.com/upstash/ratelimit-js) integration with Strapi to protect your APIs from abuse.

## Getting started

### Installation

<CodeGroup>
  ```bash npm theme={"system"}
  npm install --save @upstash/strapi-plugin-upstash-ratelimit
  ```

  ```bash yarn theme={"system"}
  yarn add @upstash/strapi-plugin-upstash-ratelimit
  ```
</CodeGroup>

### Create database

Create a new redis database on [Upstash Console](https://console.upstash.com/). See [related docs](/redis/overall/getstarted) for further info related to creating a database.

### Set up environment variables

Get the environment variables from [Upstash Console](https://console.upstash.com/), and set it to `.env` file as below:

```shell .env theme={"system"}
UPSTASH_REDIS_REST_TOKEN="<YOUR_TOKEN>"
UPSTASH_REDIS_REST_URL="<YOUR_URL>"
```

### Configure the plugin

You can use

<CodeGroup>
  ```typescript /config/plugins.ts theme={"system"}
  export default () => ({
    "strapi-plugin-upstash-ratelimit": {
      enabled: true,
      resolve: "./src/plugins/strapi-plugin-upstash-ratelimit",
      config: {
        enabled: true,
        token: process.env.UPSTASH_REDIS_REST_TOKEN,
        url: process.env.UPSTASH_REDIS_REST_URL,
        strategy: [
          {
            methods: ["GET", "POST"],
            path: "*",
            limiter: {
              algorithm: "fixed-window",
              tokens: 10,
              window: "20s",
            },
          },
        ],
        prefix: "@strapi",
      },
    },
  });
  ```

  ```javascript /config/plugins.js theme={"system"}
  module.exports = () => ({
    "strapi-plugin-upstash-ratelimit": {
      enabled: true,
      resolve: "./src/plugins/strapi-plugin-upstash-ratelimit",
      config: {
        enabled: true,
        token: process.env.UPSTASH_REDIS_REST_TOKEN,
        url: process.env.UPSTASH_REDIS_REST_URL,
        strategy: [
          {
            methods: ["GET", "POST"],
            path: "*",
            limiter: {
              algorithm: "fixed-window",
              tokens: 10,
              window: "20s",
            },
          },
        ],
        prefix: "@strapi",
      },
    },
  });
  ```
</CodeGroup>
