How do I add CAPTCHA to Lovable?
Last checked 31 Aug 2026
Short answer
Ask Lovable to integrate a CAPTCHA provider such as Google reCAPTCHA or Cloudflare Turnstile, including the site key on the front end and server-side verification of the token before accepting the submission.
CAPTCHA needs two halves
A CAPTCHA widget alone (the checkbox or puzzle users see) does nothing on its own — the token it produces must be verified server-side before you trust the submission. Skipping that step means the CAPTCHA is decorative.
Steps
- Create an account with a CAPTCHA provider (Google reCAPTCHA v2/v3, or Cloudflare Turnstile — Turnstile is generally lighter-weight and privacy-friendlier).
- Get a site key (public, goes in the front end) and a secret key (private, must stay server-side).
- Prompt Lovable:
Add Cloudflare Turnstile to the contact form. Use this site key: [key]. On submit, verify the token server-side using this secret key before saving the enquiry, and reject the submission if verification fails.
Lovable renders the widget in the form, and adds a server-side check in the function that handles submission — the secret key belongs there, never in front-end code.
Where to store the secret
Never paste the secret key directly into a component. Ask Lovable to store it as a server-side secret and reference it only from the server function.
What usually goes wrong
- Verifying only client-side: checking
token existsin the browser is trivial for a bot to fake; the secret-key verification call to the provider's API is the part that actually matters. - Forgetting to test the failure path: submit with an invalid/expired token deliberately and confirm it's rejected, not just the happy path.
- CAPTCHA on every field-level interaction: only gate the final submit, not every keystroke — that's a UX problem, not a security one.
Is CAPTCHA overkill?
For a low-traffic contact form, honeypot fields plus server-side rate limiting (see how do I stop spam form submissions) often solve the problem with less friction. Reach for CAPTCHA once spam volume actually justifies the extra step for users.
Sources
Was this answer helpful?
Related questions
- AnswerWhere do Lovable form submissions go?Nowhere, by default — a form only exists on the front end until you connect a destination: a database table (Lovable Cloud/Supabase) and/or an outgoing email via an integration like Resend.
- AnswerHow do I email form submissions to myself?Connect an email integration (Resend is the standard option), then ask Lovable to trigger a server-side function that emails you the form data whenever it's submitted.
- AnswerHow do I save form submissions to a database?Connect Lovable Cloud (or your own Supabase project), then ask Lovable to create a table for submissions and wire the form's submit handler to insert a row into it, with row-level security limiting who can read the data.
- AnswerHow do I upload files through a form?Use Lovable Cloud's (or Supabase's) storage buckets: ask Lovable to add a file input, restrict file type and size, and upload to a storage bucket with access rules controlling who can read the file later.