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
-
Load the public config in a loader or server function with
getTurnstileConfig()from#/lib/turnstile.server, and showTurnstileFieldfrom#/components/molecules/turnstile-fieldinside the form. -
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'sresetKeyafter 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.