Skip to content
recaptcha-next
reCAPTCHA v3 · React 19 · Next.js

reCAPTCHA v3 for Next.js, built for Server Actions.

A client field that keeps a fresh token in a hidden input, and a server function that checks it with Google. Typed results, one script per page, MIT licensed.

npm install recaptcha-next

01 · Why

Why recaptcha-next

Server Actions

Read the token from FormData

The token travels in the form, so an action verifies it with getRecaptchaToken and verifyRecaptcha, and gets a typed result instead of an exception.

Lazy loading

Load Google only when needed

With lazy, the script waits until the form is near the viewport, and tokens refresh before they expire.

Navigation

One script per page

The script is loaded once and shared, also across client-side navigation, so Next.js routing never leaves duplicate badges.

Fails closed

A missing secret is refused in production

A deploy without RECAPTCHA_SECRET_KEY refuses every request instead of letting everyone in. Locally, the check is skipped with a warning.

02 · Docs

Docs

Guides and reference for recaptcha-next.

All docs →

03 · Examples

Examples

Forms you can copy and adapt.

All examples →

Start using recaptcha-next

npm install recaptcha-next