Docs Set up your stack
Set up Relia in a Next.js app
One command adds Relia to a Next.js app, including apps deployed on Vercel. It writes instrumentation.ts and records every server request with Next's own route names.
This page sets Relia up by hand from a terminal. To have your AI assistant do it instead, see Set up Relia with your AI assistant.
Before you start
- A Relia account (Create your account).
- A terminal open in your Next.js app's folder.
Steps
Run the setup:
npx relia-sdk@latest initAlways use
relia-sdk: the npm package calledreliabelongs to someone else.Sign in. Choose the browser option, copy the token from the CLI Authentication page, and paste it back into the terminal.
Choose what to set up. It detects your Next.js app. Choose Everything Relia found here (your Next.js server, plus AI SDK calls if your app uses the Vercel AI SDK), or pick one kind.
Pick your Relia project, or create one right there.
Check what it wrote:
- A new
instrumentation.ts(insidesrc/when your app lives there). It starts Relia on your server, with your project's id and key inside. relia-sdkadded to yourpackage.json.- The browser side is a separate choice: run the setup again and choose Session & User journey monitoring. See Watch your web app.
Note: if you already have an
instrumentation.ts, it is left alone and the lines to add are printed instead.- A new
Next.js 13 or 14 only: turn the instrumentation hook on in
next.config:experimental: { instrumentationHook: true }Restart your app and open a page or call one of its API routes. The console says
tracing initialized.
Deploying on Vercel
Nothing to add. Serverless mode switches on by itself, and your project's id and key are already inside instrumentation.ts, so the server needs no extra environment variable.
What Relia records
- One entry per request, with Next's own route name, for example
GET /api/orders/[id]. - Errors with stack traces that point at your source files (for example
app/api/orders/[id]/route.ts:9), not compiled.nextchunks. - Outgoing calls (fetch) and database calls inside each request.
- Calls made with the Vercel AI SDK (
streamText,generateText), with no code change. See Monitor AI in your product.
Check it worked
Open your project in Relia and go to the Setup tab. Requests from your server changes from Not yet to Arriving, usually within a minute. Your requests and errors appear under APIs.
If something's wrong
- Still "Not yet" after a few minutes: restart the app once more, then see Relia shows no data.
- Next.js 13 or 14 and nothing arrives: check the
instrumentationHooksetting from step 6.
Next
Last checked against the product: 1 Nov 2026