# Cloudflare Turnstile

> Add a check to a form that helps block automated submissions and often lets visitors continue without solving a puzzle.

Web page: https://buildladder.com/tools/cloudflare-turnstile

If a contact form starts filling up with junk, Turnstile can check the visit before your site accepts the message. Its widget runs in the visitor’s browser and returns a short-lived result that your server verifies.

Try the check on a test form. Submit a normal message and make sure it reaches the inbox. Then check that the server rejects a submission missing the result. Both halves have to work for the form to benefit.

- Made by: Cloudflare
- Official site: https://www.cloudflare.com/products/turnstile/
- Cost: Free, with unlimited checks and up to 20 widgets, as of November 2026.
- What you need first: A Cloudflare account.
- Who it helps: When a sign-up, sign-in or contact form needs protecting from bots and you want no puzzles. Your site doesn’t need to be on Cloudflare.
- When to skip it: When your product has no server code to check each pass and no service, such as Supabase, that checks it for you. If you want to protect Firebase services, follow Firebase’s App Check setup.
- Updated: 2026-11-10

## Stop bots with Cloudflare Turnstile

Add a Turnstile check to a sign-up, sign-in or contact form. Your server confirms each pass before it accepts the form.

What you’ll end up with: Your form shows a Turnstile check, and your server refuses any submission without a valid pass.

### You’ll need

- A website or app with a form you want to protect, like sign-up or contact.
- Your AI tool, set up and working in your product’s folder.
- Server code that handles the form, or Supabase sign-in.
- Cloudflare account (https://dash.cloudflare.com): Free to create

### Your part

- Create the widget in the Cloudflare dashboard and copy its two keys somewhere private.
- Add the real keys to your host’s settings.
- Test the form on your live site, and check that a made-up pass is refused.

### Step 1 of 3: Create a Turnstile widget

This step is mine to do. Walk me through it, one action at a time:
- Go to dash.cloudflare.com and sign in, or create an account.
- Go to the Turnstile page in the dashboard.
- Select Add widget.
- In Widget name, type what it protects, like “Sign-up form”.
- Under Hostname management, add your site’s domain, like mysite.com. Leave out localhost. On your computer you’ll use test keys instead.
- Under Widget mode, choose Managed. It only asks a person to tick a box when it needs to.
- Select Create.
- Copy the site key and the secret key somewhere private, like a note only you can see.

It worked when: The Turnstile page lists a widget named after your form, and you have its site key and secret key.

Keep for later: You need both keys again in “Add the keys to your host and test”.

If something goes wrong:
- You can’t find the Turnstile page. Ask your AI tool: “Open Cloudflare’s current Turnstile docs and give me the link to the Turnstile page in the dashboard.”
- It says you’ve reached the widget limit. Reuse a widget you made before, or delete one you no longer use.

### Step 2 of 3: Add Turnstile and check it on the server

I want to protect a form in this product with Cloudflare Turnstile. Read PLAN.md if there is one. Check Cloudflare’s current Turnstile docs first. Don’t rely on memory.

Ask me which form to protect, like sign-up, sign-in or contact. Then:
1. If my sign-in uses Clerk, stop and tell me how to check Clerk’s own bot protection is turned on instead.
2. If my sign-in uses Supabase Auth, use Supabase’s built-in CAPTCHA support with Turnstile. Pass the captcha token to the sign-up and sign-in calls, and tell me where to paste the secret key in the Supabase dashboard.
3. Otherwise, add the Turnstile widget to that form in Managed mode, and send its pass to my server with the form.
4. On the server, check every pass with Cloudflare’s Siteverify API before doing anything else. Refuse the form if the check fails, and show a friendly message asking the person to try again.
5. Reset the widget after each send, because each pass works only once.
6. Read the site key and the secret key from environment variables. Make sure Git ignores .env, and tell me which name is public and which is secret.
7. On my computer, use Cloudflare’s test keys, which work on localhost. Put those test keys in .env for me. They are public, so that is safe. My real keys go only in my host’s settings.
8. Never put the secret key in code that runs in a browser or on a phone.

If my product has no server code, stop and explain my options before you change anything. Keep everything that already works.

It worked when: The widget shows on your form on your computer, and the form still sends when the check passes.

Before we move on, check with me:
- Did your AI tool show you the server code that calls Siteverify, or the Supabase setting it uses?

If something goes wrong:
- The widget shows error 110200, or says the domain isn’t allowed. The page’s address isn’t in the widget’s hostname list. On your computer, use the test site key 1x00000000000000000000AA. For your live site, add its domain under Hostname management.
- Your AI tool only added the widget, with no server check. Say: “Add a server check with Siteverify, and refuse the form when it fails.” Without it, a bot can skip the widget and send the form anyway.

### Step 3 of 3: Add the keys to your host and test

This step is mine to do. Walk me through it, one action at a time:
- Open your host’s environment variable settings. “Where do my API keys go?” in Answers names the page for Vercel, Netlify and Cloudflare.
- Add the site key and the secret key, using the names your AI tool gave you. Mark the secret key as secret if your host offers that.
- If you use Supabase sign-in, put the secret key in Supabase instead. In Supabase’s Authentication settings, find Bot and Abuse Protection and turn on Enable CAPTCHA protection.
- Still in Supabase, choose Turnstile as the provider, paste the secret key, and click Save.
- Put your site online again from your host, so it uses the new keys.
- Open your live site in a private browser window and send the form. It should go through.
- Ask your AI tool: “Send one request to my live form with a made-up Turnstile pass, and show me the reply.” It should be refused.

It worked when: The form on your live site goes through for a real visitor, and a made-up pass is refused.

If something goes wrong:
- The live form fails the check for everyone. Check that the secret key on your host belongs to this widget, then put the site online again. A test secret key only accepts test passes, so real visitors fail.
- The widget’s analytics show no validations. Your server isn’t calling Siteverify. Ask your AI tool to add the server check from “Add Turnstile and check it on the server”.
- The form fails when someone sends it a second time. Each pass works once and lasts 5 minutes. Ask your AI tool to reset the widget after each send, so a fresh pass is ready.

Compare Cloudflare Turnstile with the other options: https://buildladder.com/concepts/security.md
