ribaunt/widget-react handles SSR guards automatically by dynamically importing the browser-only web component on the client. Add 'use client' to your component file, import RibauntWidget, and you are ready to go — no extra configuration required.
Client component setup
Create a client component and drop inRibauntWidget. Because the wrapper handles dynamic importing internally, you do not need to wrap it in next/dynamic.
Do NOT wrap in
next/dynamic — the ribaunt/widget-react wrapper already handles dynamic importing internally. Adding an extra next/dynamic call is unnecessary and may cause double-loading.API routes
The client component above calls/api/captcha/challenge and /api/captcha/verify. You need to create those server-side endpoints to generate challenges and validate solutions. See the Next.js server guide for the full route handler implementation.
Key considerations
- Always use
'use client'—RibauntWidgetrenders in the browser and relies on browser APIs. - Don’t use
next/dynamic— the wrapper handles dynamic importing on its own; addingnext/dynamicis redundant. - Don’t expose
RIBAUNT_SECRETviaNEXT_PUBLIC_— the secret must remain server-side only. - Use HTTPS or localhost — browser solving depends on the Web Crypto API, which is restricted to secure contexts. Plain local-network HTTP URLs (e.g.
http://192.168.x.x) will not work. - For serverless or edge deployments — the default replay prevention uses process-local memory, which is not shared across serverless instances. Set
replayPrevention: 'remote'with an atomic distributed store to prevent replay attacks in those environments.