15 lines
414 B
TypeScript
15 lines
414 B
TypeScript
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!,
|
|
})
|
|
|
|
// Free tier: 3 comics per week (fixed window)
|
|
export const freeTierRateLimit = new Ratelimit({
|
|
redis,
|
|
limiter: Ratelimit.fixedWindow(3, "7 d"),
|
|
analytics: true,
|
|
prefix: "ratelimit:free-comics",
|
|
}) |