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 protect API keys?Never put API keys in front-end code — store them as secrets used only inside server functions (Edge Functions), where the browser never sees them.
- AnswerAre Lovable websites secure?Lovable includes built-in security scanning and API-key protection, but real security also depends on you setting up row-level security and role checks correctly — it isn't automatic just because you used Lovable.
- AnswerWhere should secrets be stored?In your project's server-side secrets store, used only inside Edge Functions — never in front-end code, client-side environment variables, or committed to your Git repository.
- AnswerHow do I run a security audit on Lovable?Open your project's Security view in Lovable to see automated scan results, then ask Lovable in chat to review RLS policies, role storage, and any exposed secrets in detail.