@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.1
Install the package
2
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
3
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
4
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
5
Add the provider
Starts the SDK in the browser and begins capturing. Wrap your app once, at the root layout.
app/layout.tsx
Environment variables
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
string
default:"interfere-sdk"
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
object
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:
string
required
Your internal, stable user ID. Use this rather than the email.
object
required
Where the identity came from.
type: one ofclerk,auth0, orcustomname: the provider’s display name, for example“Clerk”
string
Display name.
string
Email address.
string
Avatar URL.
object
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
Update consent at runtime through the same hook:
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.
1
Set the prefix
env NEXT_PUBLIC_INTERFERE_ROUTE_PREFIX=/__telemetry 2
Mount the handler at the matching path
ts app/__telemetry/[[...path]]/route.ts export * from "@interfere/next/route-handler"; 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 }).