AbuseGraph + Next.js App Router
Secret key in Server Actions, publishable key in the browser SDK.
Install
pnpm add @palisade/sdk @palisade/shared
Env
ABUSEGRAPH_CHECK_URL=https://your-host/api/v1/check
ABUSEGRAPH_SITE=acme.com
ABUSEGRAPH_SECRET_KEY=sk_live_...
ABUSEGRAPH_SECRET_KEY_TEST=sk_test_...
NEXT_PUBLIC_ABUSEGRAPH_PUBLISHABLE_KEY=pk_live_...
NEXT_PUBLIC_ABUSEGRAPH_EDGE_URL=https://palisade-edge.revadv.workers.dev
Server Action
'use server'
export async function signup(formData: FormData) {
const email = String(formData.get('email') ?? '')
const res = await fetch(process.env.ABUSEGRAPH_CHECK_URL!, {
method: 'POST',
headers: {
'content-type': 'application/json',
'x-api-key': process.env.ABUSEGRAPH_SECRET_KEY!,
'x-abusegraph-site': process.env.ABUSEGRAPH_SITE!,
},
body: JSON.stringify({
email,
event: 'signup',
site: process.env.ABUSEGRAPH_SITE,
}),
})
const result = await res.json()
if (result.verdict === 'block') {
return { ok: false, error: 'Unable to create account' }
}
return { ok: true, summary: result.summary }
}
Browser SDK
import { init } from "@palisade/sdk"
const sdk = init({
publicKey: process.env.NEXT_PUBLIC_ABUSEGRAPH_PUBLISHABLE_KEY!,
edgeUrl: process.env.NEXT_PUBLIC_ABUSEGRAPH_EDGE_URL!,
})
const edge = await sdk.check()
// Forward fingerprint / probes into your Server Action for a full check
Verify
Submit signup once, then open Activity.