Skip to content

Commit 168895b

Browse files
committed
refactor: Remove KV dependancy, migrate to upstash
1 parent ee1a4fe commit 168895b

File tree

4 files changed

+8
-20
lines changed

4 files changed

+8
-20
lines changed

.env.example

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ GOOGLE_CLOUD_BUCKET="" # Your Google Cloud Storage Bucket n
2323
GOOGLE_APPLICATION_CREDENTIALS_JSON="" # The content of the JSON file you download when creating a service account key
2424

2525
# Vercel KV
26-
KV_URL="" # The URL of your Vercel KV instance
27-
KV_REST_API_URL="" # The REST API URL of your Vercel KV instance
28-
KV_REST_API_TOKEN="" # The REST API token for your Vercel KV instance
29-
KV_REST_API_READ_ONLY_TOKEN="" # The read-only REST API token for your Vercel KV instance
26+
# KV_URL="" # The URL of your Vercel KV instance
27+
# KV_REST_API_URL="" # The REST API URL of your Vercel KV instance
28+
# KV_REST_API_TOKEN="" # The REST API token for your Vercel KV instance
29+
# KV_REST_API_READ_ONLY_TOKEN="" # The read-only REST API token for your Vercel KV instance
3030

3131
# Upstash_Redis
3232
UPSTASH_REDIS_REST_URL="" # REST URL of your Upstash Redis database

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
"@ungap/with-resolvers": "^0.1.0",
3232
"@upstash/ratelimit": "^2.0.5",
3333
"@upstash/redis": "^1.33.0",
34-
"@vercel/kv": "^3.0.0",
3534
"axios": "^1.8.4",
3635
"canvas": "^3.2.0",
3736
"class-variance-authority": "^0.7.1",

pnpm-lock.yaml

Lines changed: 0 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/lib/utils/ratelimit.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
import { Ratelimit } from "@upstash/ratelimit";
2-
import { kv } from "@vercel/kv";
2+
import { redis } from "./redis";
33

44
// Rate limiter for AI Upload (5 requests per 15 minutes)
55
export const aiUploadRatelimit = new Ratelimit({
6-
redis: kv,
6+
redis: redis,
77
limiter: Ratelimit.slidingWindow(5, "900 s"),
88
});
99

1010
// Rate limiter for Paper Requests (5 requests per 15 minutes)
1111
export const paperRequestRatelimit = new Ratelimit({
12-
redis: kv,
12+
redis: redis,
1313
limiter: Ratelimit.slidingWindow(5, "900 s"),
1414
});
1515

1616
// Rate limiter for Subscriptions (3 requests per hour)
1717
export const subscribeRatelimit = new Ratelimit({
18-
redis: kv,
18+
redis: redis,
1919
limiter: Ratelimit.slidingWindow(3, "1 h"),
2020
});

0 commit comments

Comments
 (0)