This is an example Solid.js 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:
- Clone this repository and navigate to the project directory:
git clone https://github.com/altcha-org/altcha-starter-solid-ts.git
cd altcha-starter-solid-ts
- Install the project dependencies:
npm install
- Start the development server:
npm run dev
If you prefer to create a new project from scratch, here are the steps:
- Create a new Vite project with the Solid.js template:
npm create vite@latest my-solid-app -- --template solid-ts
- Navigate to your project directory:
cd my-solid-app
- Install the ALTCHA widget package:
npm install altcha --save
- Import the
altcha
package in your project:
// src/index.jsx or src/main.jsx
import 'altcha';
- Use the
<altcha-widget>
element in your component:
// src/components/ExampleComponent.jsx
import { Component } from 'solid-js';
const ExampleComponent: Component = () => {
return (
<div>
<h1>My Solid.js App with ALTCHA</h1>
<altcha-widget challengeurl="https://your-challenge-url.com"></altcha-widget>
</div>
);
};
export default ExampleComponent;
- Declare JSX.IntrinsicElements:
declare module 'solid-js' {
namespace JSX {
interface IntrinsicElements {
'altcha-widget': globalThis.JSX.IntrinsicElements['altcha-widget']
}
}
}
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 Solid.js 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.