Svelte CAPTCHA Integration
Add TrustCaptcha to your Svelte or SvelteKit forms in minutes to block bots and spam on sign-ups, logins and checkouts. Use a lightweight wrapper component with your site-key. Puzzle-free UX, EU-hosted and GDPR-ready, with risk score and security rules.
Quickstart
How the integration works
1. Create a CAPTCHA
Create a user account or log in with an existing one. Then create a new CAPTCHA or select an existing one. If you’re unsure whether TrustCaptcha is right for you, try our CAPTCHA service risk-free for 14 days at no cost.
On the CAPTCHA overview page, you will find all the important information, such as the site key, secret key and licence key. Allow your websites to access your CAPTCHA by simply adding them to the access authorised domain list in the CAPTCHA security rules.


2. Integrate the CAPTCHA widget into your frontend
The following steps give you a rough idea of how to integrate the TrustCaptcha CAPTCHA widget into an Svelte frontend. For precise, detailed instructions, please read the CAPTCHA integration guide for Svelte in our documentation.
Read the documentation
First, install the Svelte wrapper package:
npm i trustcaptcha-svelteNow insert the CAPTCHA widget, the so-called TrustCaptcha element HTML tag, into any HTML form:
<script lang="ts">
import { TrustCaptcha } from "trustcaptcha-svelte";
function solved(event: CustomEvent<string>) {
const VerificationToken = event.detail;
// send VerificationToken to your backend
}
function failed(event: CustomEvent) {
const error = event.detail;
// handle error
}
</script>
<form>
<!-- your input fields -->
<TrustCaptcha
sitekey="<your_SiteKey>"
oncaptchaSolved={solved}
oncaptchaFailed={failed}
/>
<!-- further input fields / submit button -->
</form>The CAPTCHA widget will now be displayed on your Svelte website:

Note: The Svelte wrapper is a community integration maintained on GitHub by Frederic Lehmann: FrediLehmann/trustcaptcha-svelte
Need detailed information about the Svelte CAPTCHA integration?
For detailed instructions on integrating TrustCaptcha, please refer to our Svelte CAPTCHA integration guide.
Other frontend technology instead of Svelte?
If you do not want to use Svelte or have several websites or applications, you can select a different framework or platform here. If there is no pre-built integration from us for your preferred frontend technology, your software developers can integrate the CAPTCHA themselves using our documentation or ask our support-team for a pre-built integration solution.
3. Validate the CAPTCHA result in your backend
Once the CAPTCHA is complete, take the verification token and send it to your backend. In your backend, retrieve the CAPTCHA verification result from our servers and validate the result. Depending on how high the bot risk is, you decide how to proceed. You can find detailed information on backend integration and result validation in our documentation.
Prebuild backend integrations
You can use one of our pre-built integrations to integrate the CAPTCHA validation process into your backend service. If there is no pre-built integration from us for your preferred backend technology, your software developers can integrate the CAPTCHA themselves using using our documentation or ask our support-team for a pre-built integration solution.
4. Congratulations 🎉
You are now protected by TrustCaptcha - congratulations!

FAQs
What do I need to get started with Svelte?
Does it work with SvelteKit and SSR?
How do I receive the verification token?
How should I use the bot score?
Can I add multiple widgets or forms on one page?
How long is a verification token valid?
Can I customize the widget in Svelte?
Do I have to use the Svelte wrapper?
TrustCaptcha blocks spam and bots, not customers. No puzzles, GDPR-ready, EU-hosted.


Protect your Svelte application with TrustCaptcha in just a few steps!
- EU-hosted & GDPR-ready
- No puzzles
- Try free for 14 days