Short answer
Rate limiting caps how many requests a client, user or IP address may make in a given time window, and answers the rest with HTTP 429 Too Many Requests. It protects login forms against password guessing and paid endpoints, such as AI calls, e-mail and SMS, against abuse that runs up your bill. Supabase Auth limits its own endpoints; your edge functions need their own limits.
Ask an AI about this page:ChatGPTClaude
On this page
Rate limiting is a control that caps how many requests a client may send in a given time window, for example 10 AI requests per user per minute or 30 sign-in attempts per IP address per five minutes. Requests above the limit are refused, usually with HTTP status 429 Too Many Requests and, optionally, a Retry-After header that says when to try again.
Rate limiting in an AI-built app
Two kinds of endpoints in a typical Lovable or Bolt app need limits:
- Endpoints that cost money per call. An edge function that forwards prompts to OpenAI or Anthropic, sends e-mails or SMS, or generates images. Without a limit, one script can call it thousands of times. OWASP lists this as API4:2023, Unrestricted Resource Consumption, and gives the example of a reset flow that sends paid SMS being triggered over and over.
- Endpoints that check secrets. Login, password reset and one-time codes. Without a limit, an attacker can try passwords or codes at full speed, including credential stuffing with leaked passwords.
Supabase covers part of this. Supabase Auth has default limits that you can change under Authentication → Rate Limits, for example 30 sign-up and sign-in requests per five minutes per IP address, one OTP or magic link per user per 60 seconds, and only two e-mails per hour with the built-in e-mail provider. What Supabase does not limit for you is your own code: every edge function, and every paid API it calls, is unlimited until you add a limit.
How to check your app
- List every edge function or server route that calls a paid API, sends a message or checks a secret.
- For each, look for a limit before the expensive work: a counter per user or IP, a queue, or a gateway rule. If there is none, it can be called as fast as the caller likes.
- Check that the limit uses the verified user ID from the token, not a user ID from the request body, which the caller could change on every request.
- Check the spend limits and billing alerts at OpenAI, Anthropic, your e-mail and SMS providers.
- In the Supabase dashboard, review Authentication → Rate Limits and only raise them for a reason.
How to fix or prevent it
Add a limit per user and per IP in front of every paid or secret-checking endpoint, return 429 when it is hit, and set a hard spend cap at each paid provider. For direct database calls through the Data API, Supabase describes a pre-request function in Postgres that can enforce limits as well. A practical setup for AI apps, including where to keep the counters, is in Rate limiting for AI-built apps, and the fix for an unprotected login or AI endpoint is on No rate limit on login or AI endpoints.
Frequently asked questions
Does Supabase rate-limit my edge functions?
Supabase documents default rate limits for its Auth endpoints, such as sign-in, sign-up, OTP and token refresh. Limits for your own edge functions and for the calls they make to paid APIs are something you add yourself.
Should I limit per IP address or per user?
Both, where you can. Per IP stops anonymous floods; per user stops a single account from burning your AI budget from many addresses. Login forms also benefit from a limit per target account.
Is a rate limit enough to protect my AI costs?
No. A rate limit slows abuse, but many users each staying under the limit still add up. OWASP also recommends spending limits or billing alerts at every paid provider.
Sources
- 1.API4:2023 Unrestricted Resource Consumption — OWASP API Security Top 10
- 2.429 Too Many Requests — MDN Web Docs
- 3.Rate limits — Supabase Docs
- 4.Securing your API — Supabase Docs