@interfere/next connects your Next.js app to Interfere. It’s a one-time install: add a few lines, ship as usual, and Interfere captures everything your app emits (errors, sessions, traces, and logs) with no sampling and nothing to tune. From there, Interfere groups related symptoms into a single problem, decides how much it matters, and investigates the cause for you.
This page covers the install and the handful of settings most teams actually touch: naming your app, identifying your users, and respecting consent.
You’ll need a surface public key (
interfere_pub_<region>_…) from Surfaces. For source-map upload and release tracking you’ll also want an Interfere API key (interfere_secret_<region>_…). See Environment variables.Prerequisites
- Next.js
>= 16(App Router) - React
>= 19 - Node.js
>= 20
Quick start
Five steps, each wired once. After this you don’t touch it again.Wrap your Next.js config
This lets Interfere upload source maps at build time, so a production stack trace points back to your original code instead of minified output. It also tags each build as a release.
next.config.ts
Wire server instrumentation
So server-side errors get captured too, not just client-side ones. That covers Server Components, route handlers, and server actions.
instrumentation.ts
Mount the ingest route
Telemetry is sent through your own domain, so ad-blockers and CORS don’t drop it. The path must match your route prefix (default
/api/interfere).app/api/interfere/[[...path]]/route.ts
Environment variables
| Variable | Required | Description |
|---|---|---|
INTERFERE_PUBLIC_KEY | Yes | Your surface public key (interfere_pub_<region>_…, where <region> is us or eu). Safe to expose; it only authorizes ingestion. |
INTERFERE_API_KEY | For releases | Interfere API key (interfere_secret_<region>_…). A server-side build credential for source-map upload and release metadata. Never expose it in browser code. |
NEXT_PUBLIC_INTERFERE_ROUTE_PREFIX | No | Override the proxy route prefix. Defaults to /api/interfere. See Custom route prefix. |
Configuration
Interfere is built to run without tuning, so most apps install it and stop here. Reach for these only when you have a specific reason.Name your app
If you run more than one app against Interfere (a storefront and an admin panel, say), give each aserviceName so problems, sessions, and metrics are attributed to the right one. Set it in an optional instrumentation-client.ts:
instrumentation-client.ts
A stable name for this app. Interfere uses it to keep each surface’s data separate, and to
correlate the same issue across surfaces into one problem.
Choose what’s captured
By default Interfere captures all of the signals below. Turn any off withplugins. For example, disable session replay if you don’t want recordings:
instrumentation-client.ts
Each signal can be toggled on or off. All default to on.
errors: uncaught exceptionslogs: console outputdevice: device and browser infopageEvents: pageviews and clicksrageClick: rage-click detectionreplay: session replay
Identity
By default a session is anonymous. Link it to your authenticated user so a problem shows you who hit it in Users, with a name and email instead of an opaque id. Callidentity.set() from the useInterfere hook once your user loads:
Your internal, stable user ID. Use this rather than the email.
Where the identity came from.
type: one ofclerk,auth0, orcustomname: the provider’s display name, for example“Clerk”
Display name.
Email address.
Avatar URL.
Any extra metadata you want attached to the user (
Record<string, unknown>).identity.set() is deduplicated per session, so calling it on every render is fine. Identity
clears automatically when the session rotates.Consent
By default all features are active. To respect a cookie banner or privacy preference, passconsent to the provider. Once you do, only essential capture (error tracking and logs) plus the categories you opt into will run:
app/layout.tsx
| Category | What it covers | Gateable |
|---|---|---|
necessary | Error tracking, logs | Always on |
analytics | Page events, rage clicks, device info | Yes |
replay | Session replay | Yes |
Report a handled error
Interfere captures uncaught errors for you. When you catch an error yourself but still want it reported, callcapture on the client or captureError on the server.
Custom route prefix
The SDK proxies telemetry through/api/interfere by default. Move it to any path to get past ad-blocker deny-lists that target well-known SDK routes, or to fit your own API conventions.
Other frameworks
Vite + React
@interfere/vite: a Vite plugin plus init() before render. Works for SPA and SSR.TanStack Start
@interfere/vite: the same plugin, with a server route for proxying.NestJS
@interfere/nest: a backend module plus instrument.ts for server error capture.FAQ
Why isn't anything showing up in development?
Why isn't anything showing up in development?
The SDK stays quiet when
NODE_ENV !== "production", so local noise doesn’t reach your dashboard. To capture while testing, call init({ enabled: true }) in instrumentation-client.ts.Do you handle the same issue across multiple apps?
Do you handle the same issue across multiple apps?
Yes. Give each app its own
serviceName. When the same issue hits more than one surface,
Interfere correlates it into a single problem instead of a separate alert per app.Do I have to use the proxy route?
Do I have to use the proxy route?
It’s the recommended path. Proxying telemetry through your own origin avoids CORS and gets past
ad-blockers, and it’s part of the standard install above.
Can I ship errors only, without analytics or replay?
Can I ship errors only, without analytics or replay?
Yes. Disable the signals you don’t want with
plugins, for example init({ plugins: { replay: false, pageEvents: false } }). To drop browser tracing from the bundle entirely, pass init({ tracing: false }).