add upstash rate limiting

This commit is contained in:
Maze Winther
2025-06-22 13:21:03 +02:00
parent ceb253f585
commit faca97f1ae
6 changed files with 184 additions and 3 deletions
+14
View File
@@ -0,0 +1,14 @@
// lib/rate-limit.ts
import { Ratelimit } from "@upstash/ratelimit";
import { Redis } from "@upstash/redis";
const redis = new Redis({
url: process.env.UPSTASH_REDIS_REST_URL!,
token: process.env.UPSTASH_REDIS_REST_TOKEN!,
});
export const waitlistRateLimit = new Ratelimit({
redis,
limiter: Ratelimit.slidingWindow(5, "1 m"), // 5 requests per minute
analytics: true,
});