This is an example Svelte project using the ALTCHA widget.
ALTCHA is a free, open-source, self-hosted solution designed to protect websites, APIs, and online services from spam and unwanted content. It leverages a proof-of-work mechanism and is fully GDPR compliant, as it does not use cookies, fingerprinting, or tracking of any kind.
To quickly get your project up and running with the ALTCHA widget, follow these steps:
git clone https://github.com/altcha-org/altcha-starter-svelte-ts.git
cd altcha-starter-svelte-ts
npm install
npm run dev
If you prefer to create a new project from scratch, here are the steps:
npm create vite@latest my-svelte-app -- --template svelte-ts
cd my-svelte-app
npm install altcha --save
altcha
package in your project:// src/main.js
import 'altcha';
<altcha-widget>
element in your component:<!-- ExampleComponent.svelte -->
<script>
// No additional script needed for the widget
</script>
<main>
<h1>My Svelte App with ALTCHA</h1>
<altcha-widget challengeurl="https://your-challenge-url.com"></altcha-widget>
</main>
Ensure your challengeurl
points to the endpoint where ALTCHA's proof-of-work challenge is processed. Customize the component attributes as needed based on your specific use case.
With these steps, you should have a Svelte project running with the ALTCHA widget integrated. This setup helps protect your application from spam and unwanted content efficiently and compliantly. For more details, visit the ALTCHA documentation.