Fluxer implements rate limiting to prevent abuse and ensure fair resource allocation. The system uses the GCRA (Generic Cell Rate Algorithm) for smooth, accurate rate limiting with minimal memory overhead.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/fluxerapp/fluxer/llms.txt
Use this file to discover all available pages before exploring further.
Rate Limit Algorithm
Fluxer uses the GCRA algorithm, which provides:- Smooth rate limiting - No burst allowances that can be abused
- Memory efficient - Requires only 2 values per bucket
- Accurate - Precise to the millisecond
- Distributed - Works across multiple instances via shared cache
How GCRA Works
GCRA tracks:- Theoretical Arrival Time (TAT) - When the next request should be allowed
- Current Time - When the request was made
current_time >= TAT - window_ms
Rate Limit Buckets
Rate limits are organized into buckets based on the resource being accessed:Bucket Types
- Global Buckets
- Resource Buckets
- User Buckets
Applied across all endpoints for an IP or user:
Common Rate Limits
Authentication
| Endpoint | Limit | Window | Bucket |
|---|---|---|---|
| Register | 10 | 10 seconds | auth:register |
| Login | 10 | 10 seconds | auth:login |
| Login MFA | 5 | 1 minute | auth:login:mfa |
| Forgot Password | 5 | 1 minute | auth:forgot |
| Reset Password | 10 | 1 minute | auth:reset |
| Verify Email | 10 | 1 minute | auth:verify |
| Logout | 20 | 10 seconds | auth:logout |
Channels
| Operation | Limit | Window | Bucket |
|---|---|---|---|
| Get Channel | 100 | 10 seconds | channel:read::channel_id |
| Send Message | 20 | 10 seconds | channel:message:create::channel_id |
| Edit Message | 20 | 10 seconds | channel:message:update::channel_id |
| Delete Message | 20 | 10 seconds | channel:message:delete::channel_id |
| Bulk Delete | 10 | 10 seconds | channel:message:bulk_delete::channel_id |
| Add Reaction | 30 | 10 seconds | channel:reactions::channel_id |
| Typing Indicator | 20 | 10 seconds | channel:typing::channel_id |
| Get Messages | 100 | 10 seconds | channel:messages:read::channel_id |
| Pin Message | 20 | 10 seconds | channel:pins::channel_id |
Voice
| Operation | Limit | Window | Bucket |
|---|---|---|---|
| Get Call | 60 | 10 seconds | channel:call:get::channel_id |
| Update Call | 10 | 10 seconds | channel:call:update::channel_id |
| Ring | 5 | 10 seconds | channel:call:ring::channel_id |
| Stop Ringing | 20 | 10 seconds | channel:call:stop_ringing::channel_id |
Multi-Factor Authentication
| Operation | Limit | Window | Bucket |
|---|---|---|---|
| Enable SMS MFA | 10 | 1 minute | mfa:sms:enable |
| Disable SMS MFA | 10 | 1 minute | mfa:sms:disable |
| WebAuthn Registration | 10 | 1 minute | mfa:webauthn:register |
| WebAuthn List | 40 | 10 seconds | mfa:webauthn:list |
| WebAuthn Delete | 10 | 1 minute | mfa:webauthn:delete |
Phone Verification
| Operation | Limit | Window | Bucket |
|---|---|---|---|
| Send Verification | 5 | 1 minute | phone:send_verification |
| Verify Code | 10 | 1 minute | phone:verify_code |
| Add Phone | 10 | 1 minute | phone:add |
| Remove Phone | 10 | 1 minute | phone:remove |
Rate Limit Headers
Fluxer includes rate limit information in HTTP response headers:Header Descriptions
| Header | Description |
|---|---|
X-RateLimit-Limit | Maximum number of requests in the window |
X-RateLimit-Remaining | Requests remaining in the current window |
X-RateLimit-Reset | Timestamp (ms) when the limit resets |
X-RateLimit-Bucket | Bucket identifier for this rate limit |
Retry-After | Seconds until the rate limit resets (on 429) |
Rate Limit Errors
When a rate limit is exceeded, the API returns:429 Too Many Requests
Error Fields
Error code:
RATE_LIMITEDHuman-readable error message
Seconds to wait before retrying
Whether this is a global rate limit (affects all endpoints)
Implementation
Service Architecture
Checking Rate Limits
Bucket-Based Limits
Global Rate Limits
Resetting Limits
Rate Limit Configuration
Route Configuration
Define rate limits for API routes:Middleware
Apply rate limiting middleware:Best Practices
Respect Rate Limits
Always check rate limit headers and implement exponential backoff when hitting limits.
Use Bucket Identifiers
Include resource IDs in bucket names to isolate rate limits per channel/guild/user.
Cache Service
Use a distributed cache (Redis) in production for rate limiting across multiple API instances.
Monitor Usage
Track rate limit hits to identify potential abuse or legitimate high-traffic patterns.
Handling Rate Limits
Exponential Backoff
Queue-Based Approach
Special Cases
Global Rate Limits
Global rate limits apply across all API endpoints for a user/IP:Slowmode
Channel-specific slowmode is a special rate limit:BYPASS_SLOWMODE permission are exempt.