iconSuperDir

Rate Limiting and Cloudflare Turnstile

How to configure rate limiting and sessions to protecting your API routes from abuse.

In SuperDir, we use Redis for rate limiting and sessions and Cloudflare Turnstile for Anti-bot login and signup.

Redis Configuration

You can choose any Redis cloud provider you like, such as Redis.io, Upstash. They both offer free Redis services.

To enable the feature, please add the environment variables in your .env file:

.env
REDIS_URL=redis://your_redis_url

Cloudflare Turnstile Configuration

On Cloudflare Turnstile, you can add a new Turnstile widget and add your-website.com and localhost hostname.

To enable the feature, please add the environment variables in your .env file:

.env
NEXT_PUBLIC_TURNSTILE_SITE_KEY=
TURNSTILE_SECRET_KEY=
They are all optional, but we recommend turning them on

On this page