@mondaycom/hatcha-server
v0.1.2
Published
Server middleware for HATCHA — Next.js and Express handlers
Readme
@mondaycom/hatcha-server
Server middleware for HATCHA — a reverse CAPTCHA that proves you're an AI agent, not a human. Includes Next.js App Router and Express adapters.
Installation
npm install @mondaycom/hatcha-server @mondaycom/hatcha-coreNext.js App Router
// app/api/hatcha/[...hatcha]/route.ts
import { createHatchaHandler } from "@mondaycom/hatcha-server/nextjs";
const handler = createHatchaHandler({
secret: process.env.HATCHA_SECRET!,
});
export const GET = handler;
export const POST = handler;Express
import express from "express";
import { hatchaRouter } from "@mondaycom/hatcha-server/express";
const app = express();
app.use(express.json());
app.use("/api/hatcha", hatchaRouter({ secret: process.env.HATCHA_SECRET! }));
app.listen(3000);Configuration
| Option | Type | Default | Description |
|--------|------|---------|-------------|
| secret | string | — | Required. HMAC secret for signing challenge tokens |
| tokenTTL | number | 120 | Token time-to-live in seconds |
| challengeTypes | string[] | all | Restrict to specific challenge types |
Environment variables
# .env.local
HATCHA_SECRET=your-random-secret-hereFull documentation
See the HATCHA monorepo for full documentation, React components, and examples.
