A simple Budibase plugin that adds human-verification protection to forms using Cloudflare Turnstile or Google reCAPTCHA (v2 and v3).
- Adds a CAPTCHA field to a Budibase form.
- Generates a CAPTCHA token and stores it in a hidden form field when the user completes the challenge.
- Prevents the form from submitting unless a valid token exists.
- Supports three providers:
cloudflare— Cloudflare Turnstilerecaptcha2— Google reCAPTCHA v2recaptcha3— Google reCAPTCHA v3
This component handles frontend validation only. Without server-side verification, anyone can bypass the CAPTCHA and submit your form directly via API.
You must verify the CAPTCHA token on your backend by calling your CAPTCHA provider's verification API. See BACKEND-SETUP.md for complete setup instructions.
- Get your secret/private key from Cloudflare or Google
- Add a backend verification step in your Budibase workflow or API
- Call
verifyToken()in lib/verifyToken.js with the token, provider, and secret key - Only accept form submission if verification succeeds
Without this, the CAPTCHA is purely aesthetic.
- Place the
budiCAPTCHAcomponent inside aFormorForm Blockcomponent. - Configure the
Provider Namesetting to choose one of:Cloudflare TurnstilereCAPTCHA v2reCAPTCHA v3
- Provide your CAPTCHA
Site Key. - Optionally bind the token to a field using
Form Field, or leave it empty to use the plugin's hidden token field.
- Set
Provider NametoCloudflare Turnstile. - Enter your Turnstile site key in the
Site Keyfield. - The plugin will render the Turnstile widget in the form.
- The form will only submit after the Turnstile challenge is completed and a token is generated.
Note about Invisible mode
- If you choose
Size: Invisiblefor Turnstile, the component automatically intercepts the closest form's submit event, callsturnstile.execute(widgetId), and resumes submission once a token is returned. This ensures invisible widgets behave correctly without extra wiring in your form logic.
Testing and integration
- This repository includes automated test helpers:
npm testruns a mock-based unit test harness (test/run-tests.js).npm run test:integrationruns a live integration runner (test/integration-run.js) — requires provider secret keys and freshly generated tokens exported as environment variables. Seetest/INTEGRATION.mdfor details.
- Set
Provider NametoreCAPTCHA v2. - Enter your reCAPTCHA v2 site key in the
Site Keyfield. - The plugin will render the reCAPTCHA checkbox widget.
- The form will only submit after the user checks the reCAPTCHA box and a token is generated.
- Set
Provider NametoreCAPTCHA v3. - Enter your reCAPTCHA v3 site key in the
Site Keyfield. - No user interaction is required.
- The plugin automatically executes the reCAPTCHA action and refreshes the token periodically.
Validationallows you to add custom Budibase validation rules for the CAPTCHA field.Form Fieldcan be used to bind the CAPTCHA token to an existing form field. If left empty, the plugin uses a hidden field named_bb_captcha_token.Alignmentcontrols how the CAPTCHA widget is placed inside the form:left,center, orright.
Themecontrols the visual theme of the CAPTCHA widget. Common options includeAuto,Light, andDark.Sizecontrols widget layout. For Cloudflare Turnstile,FlexibleandInvisibleare supported; for reCAPTCHA v2 the plugin falls back to the normal checkbox widget.Actionis only meaningful forreCAPTCHA v3and is shown only whenProvider Nameis set toreCAPTCHA v3. It labels the reCAPTCHA action sent to Google (for examplesubmitorlogin). This is optional and defaults tosubmit. It will be ignored if you select Cloudflare Turnstile or reCAPTCHA v2.
The plugin supports Budibase style controls for the component container, including:
Padding— adjust internal spacing around the CAPTCHA widgetBackground— set the background color behind the widgetBorder— configure border style, width, and color for the CAPTCHA container
These settings let you visually match the CAPTCHA block with your form layout and branding.
- The
Form Fieldsetting is optional. When no field is provided, the plugin registers a hidden token field automatically. - If you bind the CAPTCHA token to an existing form field, make sure that field is included in your form's validation rules.
- If the CAPTCHA script fails to load, the component displays an error message instead of a widget.
From the plugin directory:
npm run buildFor continuous rebuilds while editing:
npm run watchIf you are running Budibase in Docker, restart the Budibase service after building so the plugin bundle is reloaded.