Rate Limiting

تحديد معدل الطلبات

GLS-000107

Intermediateauth-security1 min read
rate limitthrottlingrequest throttleapi rate limitddos protection

Definition

Restricting how many requests a client can make in a given time period to prevent abuse.

تقييد عدد الطلبات التي يمكن للعميل تقديمها في فترة زمنية معينة لمنع الإساءة.

Why It Matters

Without rate limiting, a bot could spam 404Fault's AI endpoints and exhaust OpenAI credits in minutes.

بدون تحديد المعدل، يمكن لبوت إرسال طلبات مكثفة لنقاط AI في 404Fault واستنفاد رصيد OpenAI في دقائق.

Full Definition

Rate limiting caps the number of requests from a single IP or user within a time window (e.g., 100 requests per minute). It prevents: API abuse, brute-force login attempts, denial-of-service attacks, and runaway AI token usage. Vercel provides edge-level rate limiting. Custom rate limiters can be implemented in Next.js Middleware using Redis or similar.
تحديد معدل الطلبات يُحدِّد حقق الطلبات من IP واحد أو مستخدم واحد خلال نافذة زمنية (مثلاً 100 طلب في الدقيقة). يمنع: إساءة استخدام API ومحاولات تسجيل الدخول بالقوة الغاشمة وهجمات رفض الخدمة واستخدام رموز AI المفرط. Vercel توفر تحديد معدل على مستوى Edge. يمكن تطبيق محددات معدل مخصصة في Next.js Middleware باستخدام Redis أو ما يشابهه.

Example Usage

The /api/admin/glossary/patch-seed endpoint is protected by a secret token — an additional rate limiting layer preventing brute-force guessing of the token.

نقطة النهاية /api/admin/glossary/patch-seed محمية برمز سري — طبقة تحديد معدل إضافية تمنع تخمين الرمز بالقوة الغاشمة.

Knowledge Graph

Avoid these mistakes when using Rate Limiting:

1

Only rate limiting by IP (VPNs and botnets use many IPs)

2

Not rate limiting AI/LLM endpoints specifically — they're expensive to abuse

Sign in to unlock guided AI explanations from AI Teacher.

Generate a Prompt

Copy this prompt and use it directly with any AI model — no setup needed.

Ready-to-Use Prompt
Help me build a project using Rate Limiting.

Explain:
1. What is Rate Limiting and why it matters
2. The core architecture and required tools
3. Step-by-step implementation plan
4. Common mistakes to avoid: Only rate limiting by IP (VPNs and botnets use many IPs), Not rate limiting AI/LLM endpoints specifically — they're expensive to abuse
5. Best practices and production tips

Official Resources