Skip to content

Feat/rate limiting - #20

Merged
Yentec merged 6 commits into
mainfrom
feat/rate-limiting
Jun 10, 2026
Merged

Feat/rate limiting#20
Yentec merged 6 commits into
mainfrom
feat/rate-limiting

Conversation

@Yentec

@Yentec Yentec commented Jun 10, 2026

Copy link
Copy Markdown
Owner

Description

Upstash Redis rate limiting for createPost and toggleVote

Changes

  • Installed @upstash/ratelimit and @upstash/redis
  • Created lib/ratelimit.ts — two named limiters (slidingWindow for createPost, fixedWindow for toggleVote), fallback to no-op if Upstash is not configured
  • Integrated into server/actions/posts.ts and server/actions/votes.ts — check after auth(), before any Prisma request
  • Added UPSTASH_REDIS_REST_URL and UPSTASH_REDIS_REST_TOKEN to .env.example
  • Updated CLAUDE.md — corrected the architecture tree, rate limiting spec, and Server Actions flow

Validation

  • Unit tests pass (26/26)
  • Clean typecheck
  • Build successful
  • Rate limiters tested with mock vi.hoisted + success: false case
  • Dev server functional without Upstash credentials

Closes #13

@Yentec
Yentec merged commit 1a846d7 into main Jun 10, 2026
3 checks passed
@Yentec
Yentec deleted the feat/rate-limiting branch June 10, 2026 09:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

enhance: rate limiting on createPost and toggleVote

1 participant