The Problem
During free trial periods, bots can rapidly create accounts to abuse your service. You need to limit the total number of signups across your entire application without blocking legitimate users.Solution: Global Fixed Window Rate Limit
Use a global rate limit with a fixed window strategy to cap total signups per hour. This doesn’t require user authentication since it applies to all signups collectively.Configuration
convex/rateLimits.ts
Implementation
Backend Mutation
convex/auth.ts
Client-Side Usage
src/SignupForm.tsx
Testing the Rate Limit
Verify the limit is working:convex/test.ts
Common Variations
- Different Time Windows
- With Capacity for Bursts
- Graceful Degradation
Best Practice: Monitor your signup rate limit metrics. If legitimate users are frequently hitting the limit, increase the
rate or use a per-IP rate limit instead.