Monitor a v0 app
Watch the Next.js app you built with v0 once real people use it: failing requests, errors, slow requests, AI costs and visit replays, with evidence your coding agent can act on.
Where this stands: we haven't tested this setup end to end inside v0 yet. v0 builds Next.js apps, and the steps below use Heystack's standard Next.js setup. Where v0 may get in the way, this page says so.
What you get
v0 builds Next.js apps and publishes them to Vercel. Heystack's Next.js setup covers both halves of such an app:
- Your server. Each request your app handles, step by step and with how long it took, plus failing requests and server errors. These feed Home and Issues, where an issue shows how many people it affected and, when you tag releases, suggests the release where it started.
- Your visitors' browsers. Errors visitors hit, optional session replay, and visits under Users & sessions.
- AI calls, if your app uses the Vercel AI SDK (versions 5, 6 and 7): calls, model, tokens, cost, failures, how long they took and how long until the first word, tools and which feature made each call, in AI & Safety, plus a Health view of how your AI answers are doing. See Find out why your AI app is slow or expensive.
- Your coding agent in the loop. Connect Cursor, Claude Code or another agent so it can read the same evidence. See Give Cursor or Claude Code your production errors.
Set it up
-
Create an app and your keys. Sign in at console.heystack.dev and create an app (during early access, new accounts join a waitlist first). Your app's Connect page shows a server key (
sk_live_…). Then, under Settings › App › Connection & keys, choose New browser key and copy it too (hs_web_…). Each key is shown once. -
Ask v0 to add Heystack. Paste this into v0's chat:
Add Heystack monitoring to this Next.js app. Follow the Next.js section of https://heystack.dev/heystack-setup.md, with the service name "my-v0-app". - Register Heystack in instrumentation.ts. The server key is read from HEYSTACK_API_KEY. - Never put the server key in browser code or in a NEXT_PUBLIC_ variable. - Also follow the "Browser / web frontend" section: a small "use client" component, mounted once in app/layout.tsx, reading the public browser key from NEXT_PUBLIC_HEYSTACK_WEB_KEY. - If the app calls an AI model with the AI SDK (generateText, streamText, generateObject, streamObject), follow the AI SDK steps of that guide: on AI SDK 7, install @ai-sdk/otel and register it once at startup, then set telemetry.functionId on each call; on AI SDK 5 or 6, turn on experimental_telemetry with a functionId on each call.If v0 can't open the link, open heystack-setup.md yourself and paste its Next.js and "Browser / web frontend" sections into the chat.
-
Add the keys as environment variables. Add
HEYSTACK_API_KEY(the server key) andNEXT_PUBLIC_HEYSTACK_WEB_KEY(the browser key) in your project's environment variables, in v0 or in the Vercel project's settings, for each environment you publish to. The browser key is made to be public and can only send data to Heystack. The server key is private. -
Turn on session replay (optional). In the console, open Settings › App › Data & privacy, turn on session replay and pick a sample rate. Nothing is recorded until you do. Errors are collected either way.
-
Publish and check. Publish, then open your app and click around. Your app's Connect page in the console says First signal received when data arrives, usually within a minute.
Good to know
- Edge runtime. Routes set to run on Vercel's Edge runtime aren't recorded; Heystack's server setup does nothing there. Routes on the default Node.js runtime are recorded.
- AI calls. Only calls made with the Vercel AI SDK's telemetry turned on are counted. On AI SDK 7 that means installing the AI SDK's telemetry package and registering it once:
experimental_telemetryon its own sends nothing there. Each call shows under its real provider (OpenAI, Anthropic and so on), including calls through the Vercel AI Gateway, and is counted once. If Heystack sees your app calling an AI provider without these details, Settings › App says so. See AI frameworks. - Releases. To see which release a problem started in, ask v0 to pass a release name and commit to Heystack. When your project deploys from GitHub, Vercel provides the commit as
VERCEL_GIT_COMMIT_SHA. See Attribute telemetry to a release. - Keep testing separate. Preview deployments send data too if they have the keys. To keep them apart from production, give previews a second Heystack app's keys.
Related
- Next.js: the full Next.js setup.
- Session Replay: replay, browser errors and masking.
- Quickstart for every other kind of app.