Overview
In this 5-minute quickstart, you’ll add Keverd to a Next.js app and get:- Persistent device IDs that survive incognito, VPNs, and browser clears
- Real-time risk scores for every user action
- Automatic fraud detection with minimal setup
Prerequisites
- Node.js 18+ and npm
- Your Favorite Code Editor
- A Next.js app (new or existing, App Router or Pages Router)
- 5 minutes of your time
This quickstart covers the frontend setup only. You’ll need a backend server to receive and process device identification events for full fraud detection. Check out one of the backend quickstarts after completing this.
Step 1: Get Your API Key
- Sign up for a free Keverd account at dashboard.keverd.com/request-access
- Navigate to Settings → API Keys
- Copy your Public API Key (starts with
pk_live_)
Step 2: Install the SDK
We use the
@keverdjs/react package for Next.js. It is fully compatible with both App Router and Pages Router.Step 3: Wrap Your App with KeverdProvider
Choose your router below. The provider prepares Keverd but does not trigger API calls yet.App Router
Create a client component wrapper:Pages Router
Step 4: Initialize Fingerprinting
Keverd only starts collecting device data and making API calls when a component callsuseKeverd(). This is intentional — it gives you control over when fingerprinting happens (e.g., on login, checkout, or page load).
useKeverd() must be called inside a Client Component ('use client' in App Router). It cannot be used in Server Components.Basic usage — trigger on component mount:
How It Works
Key point: If no component calls
useKeverd(), Keverd stays idle. No API calls are made. No device data is collected.
Complete Example
App Router
Pages Router
What About My Backend?
OnceuseKeverd() has resolved, Keverd automatically injects headers into your HTTP requests:
Using in API Routes
Testing It Works
1. Verify the Hook Triggers the Call
Open DevTools Network tab, then mount a client component withuseKeverd(). You should see a request to Keverd’s API.
2. Check the Console
3. Test Incognito Persistence
4. View Your Dashboard
Visit dashboard.keverd.com to see devices, risk scores, and blocked attempts.Common Questions
Q: Can I trigger fingerprinting without rendering UI? Yes. Create an invisible client component that callsuseKeverd() on mount, or call the imperative API directly (see JavaScript Quickstart).
Q: What if I call useKeverd() in multiple components?
The SDK deduplicates — only one API call is made, and all components share the result.
Q: Does KeverdProvider itself make any API calls?
No. It only sets up context. The first useKeverd() call triggers all fingerprinting logic.
Q: Can I use useKeverd() in a Server Component?
No. Device fingerprinting requires browser APIs (canvas, WebGL, etc.) that only exist on the client. Always use 'use client' in App Router.
Q: Will this affect my Core Web Vitals?
The SDK is loaded asynchronously and fingerprinting is deferred until useKeverd() is called. It does not block the initial page render.
