FCaptcha icon indicating copy to clipboard operation
FCaptcha copied to clipboard

Example: Next.js App Router form with server-side verification

Open cport1 opened this issue 1 month ago • 1 comments

examples/ has runnable integrations for Hono, Supabase, FastAPI and a plain Node contact form. A Next.js (App Router) example would cover a lot of people.

What to do

Add examples/nextjs/ with:

  • a page with a form that renders the checkbox widget (load fcaptcha.js with next/script, or render it in a client component)
  • a server action or route handler that verifies the posted fcaptcha_token against /turnstile/v0/siteverify (or /api/token/verify) and rejects the submission if it fails
  • a README with how to run it against a local FCaptcha server (docker run … ghcr.io/webdecoy/fcaptcha)

examples/hono/ and examples/fastapi/ show the shape, including tests for a replayed and a missing token.

Done when

The example runs from its README, and a link is added under "Runnable examples" in the main README.

cport1 avatar Oct 13 '26 14:10 cport1

I can take this. I'll add a runnable App Router form, server-side token verification, and tests for missing and replayed tokens.

CreedTech avatar Oct 13 '26 20:10 CreedTech