How do I stop bots?
Last checked 31 Aug 2026
Short answer
Add a CAPTCHA (e.g. Cloudflare Turnstile) to public forms, validate inputs server-side, and rate-limit submissions — client-side-only checks like a hidden field are easy for real bots to bypass.
Layered approach
No single measure stops all bots; combine a few:
- CAPTCHA/challenge on public sign-up, contact, or comment forms — Cloudflare Turnstile or Google reCAPTCHA are common choices your Edge Function can verify server-side.
- Honeypot fields — an invisible form field real users never fill in; if it's filled, silently reject the submission. Cheap to add, catches unsophisticated bots.
- Rate limiting per IP/user on submission endpoints (see /questions/how-do-i-rate-limit-an-api).
- Server-side validation — check email format, field lengths and required fields in the Edge Function, not just in the browser, since a bot can call the endpoint directly.
A prompt that helps
Add Cloudflare Turnstile to the sign-up form, verify the token server-side in the Edge Function before creating the account, and add a honeypot field as a second layer.
What CAPTCHA alone won't fix
A CAPTCHA on the sign-up form doesn't stop abuse of an Edge Function called directly, bypassing the form entirely. The server-side check on submission is what actually matters; the CAPTCHA widget is only useful if its token is verified server-side, not just present in the request.
What usually goes wrong
Adding a CAPTCHA to the front end but never verifying the token in the Edge Function — the check needs to happen where the data lands, not just where the form is displayed. See /questions/how-do-i-prevent-spam-registrations and /questions/how-do-i-rate-limit-an-api for related defences.
Sources
Was this answer helpful?
Related questions
- AnswerHow do I make Lovable perform a security review without changing anything?Explicitly tell Lovable to run in read-only review mode — ask it to report findings only and not touch any code, then decide what to fix yourself.
- AnswerHow do I protect admin pages?Check the user's role server-side (in the database query or Edge Function) using a dedicated user_roles table — hiding an admin link in the navigation menu doesn't stop someone visiting the URL directly.
- AnswerHow do I prevent spam registrations?Verify email addresses on sign-up, add a CAPTCHA to the registration form, rate-limit sign-up attempts per IP, and check the token server-side before creating an account.
- AnswerHow do I check Supabase RLS?Ask Lovable to list every table and its row-level security status and policies in plain language — Lovable Cloud users don't have Supabase dashboard access, so this has to go through chat.