All docs pages
Docs

Bot protection

Stops bots on sign-up, login and contact forms without puzzles for people.

In stackly.json and the CLI it is bot-protection. It has no price of its own; see What features cost.

bot-protection · optional · needs backend · Turnstile · binding APP_TURNSTILE

Stops bots on sign-up, login and contact forms without puzzles for people.

Turn it on

"features": ["backend", "bot-protection"]

Use it

  1. Load the public config in a loader or server function with getTurnstileConfig() from #/lib/turnstile.server, and show TurnstileField from #/components/molecules/turnstile-field inside the form.

  2. On the server, verify before any side effect, with the same fixed action:

    import { verifyTurnstile } from "#/lib/turnstile.server";
    
    if (!(await verifyTurnstile(formData, "contact"))) {
      return new Response("Please try again.", { status: 403 });
    }
    
  • Actions: 1–32 letters, digits, _ or -. Change the field's resetKey after a failed submit so the visitor gets a new token.
  • For an edge challenge on a whole page, put it under /__stackly/challenge/<page> on live (src/routes/[__stackly]/challenge/<page>.tsx).

Locally

stackly dev shows a local verification button, so success and failure can be tried without Cloudflare.

All app features