> ## Documentation Index
> Fetch the complete documentation index at: https://captcha.ribaunt.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Ribaunt

> Ribaunt is a stateless proof-of-work CAPTCHA library for Node.js and browsers — no databases, no third-party services, just signed JWT challenges.

Ribaunt is a stateless proof-of-work CAPTCHA library for Node.js and modern browsers. Your server issues challenges as signed JWTs, the browser widget solves the PoW puzzle, and your server verifies the submitted proof — all without touching a database. Drop it in front of any form, sign-up flow, or API endpoint to stop bots while keeping the experience smooth for real users.

<CardGroup cols={2}>
  <Card title="Introduction" icon="book-open" href="/introduction">
    Learn what Ribaunt is, how proof-of-work CAPTCHA protects your app, and why stateless verification makes deployment simple.
  </Card>

  <Card title="Quickstart" icon="rocket" href="/quickstart">
    Install Ribaunt, configure your secret, add two server endpoints, and embed the browser widget in under five minutes.
  </Card>

  <Card title="Server Setup" icon="server" href="/server/express">
    Full Express server example with challenge and verify endpoints, replay protection, context binding, and TypeScript types.
  </Card>

  <Card title="API Reference" icon="code" href="/api/create-challenge">
    Complete reference for `createChallenge`, `verifySolution`, `solveChallenge`, adaptive workload selection, and widget configuration.
  </Card>
</CardGroup>

## Get up and running in four steps

<Steps>
  <Step title="Install Ribaunt">
    Add the package to your project with your preferred package manager.

    ```bash theme={null}
    npm install ribaunt
    ```
  </Step>

  <Step title="Set RIBAUNT_SECRET">
    Add a strong, randomly generated secret to your server environment. Ribaunt uses it to sign and verify JWT challenge tokens.

    ```env theme={null}
    RIBAUNT_SECRET="replace-with-a-long-random-secret"
    ```
  </Step>

  <Step title="Add server endpoints">
    Create a `GET /api/captcha/challenge` endpoint that issues challenges and a `POST /api/captcha/verify` endpoint that validates solutions.

    ```ts theme={null}
    import { createChallenge, verifySolution } from 'ribaunt';

    app.get('/api/captcha/challenge', (_req, res) => {
      const challenges = createChallenge({ difficulty: 5, amount: 4, ttlSeconds: 120 });
      res.json({ challenges });
    });

    app.post('/api/captcha/verify', async (req, res) => {
      const { tokens, solutions } = req.body;
      const result = await verifySolution(tokens, solutions);

      if (!result.valid) {
        return res.status(400).json({ success: false, error: result.reason, message: result.message });
      }

      return res.json({ success: true });
    });
    ```
  </Step>

  <Step title="Drop in the widget">
    Add the web component to your HTML page. It fetches a challenge, solves it in the browser, and emits a `verify` event when done.

    ```html theme={null}
    <script type="module" src="/node_modules/ribaunt/dist/widget-browser.js"></script>

    <ribaunt-widget
      challenge-endpoint="/api/captcha/challenge"
      verify-endpoint="/api/captcha/verify"
      auto-verify="true"
    ></ribaunt-widget>

    <script>
      document.querySelector('ribaunt-widget')
        .addEventListener('verify', (event) => {
          console.log('Verified!', event.detail.solutions);
        });
    </script>
    ```
  </Step>
</Steps>
