feat: add basic webui

This commit is contained in:
2024-12-30 06:39:09 +08:00
parent 608a7fb9c6
commit a4c549e7c3
462 changed files with 35900 additions and 2491 deletions

View File

@@ -0,0 +1,17 @@
import { env } from '@konobangu/env';
import { Ratelimit, type RatelimitConfig } from '@upstash/ratelimit';
import { Redis } from '@upstash/redis';
export const redis = new Redis({
url: env.UPSTASH_REDIS_REST_URL,
token: env.UPSTASH_REDIS_REST_TOKEN,
});
export const createRateLimiter = (props: Omit<RatelimitConfig, 'redis'>) =>
new Ratelimit({
redis,
limiter: props.limiter ?? Ratelimit.slidingWindow(10, '10 s'),
prefix: props.prefix ?? 'next-forge',
});
export const { slidingWindow } = Ratelimit;

View File

@@ -0,0 +1,18 @@
{
"name": "@konobangu/rate-limit",
"version": "0.0.0",
"private": true,
"scripts": {
"clean": "git clean -xdf .cache .turbo dist node_modules",
"typecheck": "tsc --noEmit --emitDeclarationOnly false"
},
"dependencies": {
"@konobangu/env": "workspace:*",
"@upstash/ratelimit": "^2.0.5",
"@upstash/redis": "^1.34.3"
},
"devDependencies": {
"@konobangu/typescript-config": "workspace:*",
"typescript": "^5.7.2"
}
}