Rate Limiting
Protect your APIs from abuse and ensure fair usage with MoroJS's built-in rate limiting capabilities. Configure limits per user, IP, or custom keys.
Basic Rate Limiting
Route-Level Rate Limiting (Chainable API)
typescript
Application Configuration
typescript
Advanced Configuration
Custom Rate Limit Keys
typescript
Custom Error Responses
typescript
Rate Limiting Strategies
Common Patterns
- Authentication: 5 attempts per 15 minutes
- API calls: 1000 requests per hour
- File uploads: 10 uploads per hour
- Password reset: 3 attempts per hour
Best Practices
- Use appropriate time windows
- Provide clear error messages
- Include retry-after headers
- Monitor and adjust limits