Installation
Install NoSkrap with Bun:
bun add noskrapNoSkrap ships ESM exports:
| Export | Use |
|---|---|
noskrap/next |
Next.js proxy and route handler helpers. |
noskrap/core |
Framework-independent scoring and storage types. |
noskrap/redis |
Atomic shared storage with Redis client adapters. |
noskrap/client |
Browser popup helper. |
Requirements
- Next.js 15 or newer for
noskrap/next. - A secret of at least 32 characters in
NOSKRAP_SECRET. - A shared
BotStoragefor production, including a single Next.js server.noskrap/redisprovides one; see the API reference.
Environment
NOSKRAP_SECRET="replace-with-at-least-32-random-characters"Use secret rotation by passing an array. The first secret signs new cookies; all secrets verify existing cookies.
secret: [process.env.NOSKRAP_SECRET!, process.env.NOSKRAP_OLD_SECRET!]Production notes
- Visitor cookies are HMAC signed and use
HttpOnly,Secure,SameSite=Lax, andPath=/. - Never log raw secrets, complete cookies, or challenge tokens.
- Omitting
storagefalls back to bounded, in-memory, process-local storage and logs a warning. Rate limiting and interaction continuity degrade silently across instances, so provide a sharedBotStoragesuch asRedisBotStoragein production. - Configure client IP resolution only from infrastructure-provided values you trust.
- NoSkrap is risk scoring, not guaranteed bot blocking.