mirror of
https://github.com/bitbaum/botsmann.git
synced 2026-12-04 20:18:11 +01:00
In-memory rate limiting (LRU cache + Map) doesn't work correctly in serverless — each function instance has its own memory. Replace with a Supabase PostgreSQL function that atomically checks and increments per key, shared across all instances. - Add rate_limits table + check_rate_limit SQL function (migration 010) - Rewrite lib/rate-limit.ts to call Supabase RPC instead of LRU cache - Simplify lib/middleware/rate-limit.ts to wrap the new checkRateLimit - Update all 7 routes using the old LRU-based limiter - Remove lru-cache and @types/lru-cache dependencies - Auth routes (5) unchanged — they already use the middleware wrapper Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>