Monitoring guide
How to monitor a Next.js app
A Next.js app runs code in three places: the browser, the Node.js server and often the edge. Each can fail on its own, so monitoring has to see all three.
4 min read9 sectionsUpdated
On this page
Why a Next.js app needs its own monitoring
Server components, server actions, route handlers, middleware and static pages all fail differently. A static page can serve fine while a server action throws on every submit; middleware can slow every request by a few hundred milliseconds; a revalidation bug can serve stale data for hours without a single error.
Next.js has built-in OpenTelemetry support (the instrumentation.ts file) and reports Web Vitals through useReportWebVitals, but it does not store, chart or alert on anything. You need a backend for traces, errors and vitals, and outside checks for uptime.
What typically goes wrong
- Server actions or route handlers throwing after a deploy, while static pages still load.
- Slow server rendering because of an uncached
fetchor a slow database query in a server component. - Hydration errors and client exceptions that only appear in some browsers.
- Stale or missing pages because ISR or
revalidatePathdid not run. - Large JavaScript bundles hurting LCP and INP on mobile.
| Signal | How to measure it | Alert when |
|---|---|---|
| Uptime of the main pages and API | HTTP check every minute from several regions, with a keyword assertion | Two regions fail in a row |
| Server render and API latency | OpenTelemetry traces from `instrumentation.ts` | p95 above your target for 10 minutes |
| Core Web Vitals (LCP, INP, CLS) | Real user monitoring script on every page | p75 LCP over 2.5 s or INP over 200 ms for a day |
| JavaScript and server errors | Error tracking from traces and the browser | A new error type, or a spike after a deploy |
| Freshness of ISR pages | Keyword check for content that should change | Expected text missing |
| Certificate and domain expiry | SSL check with each uptime check | Under 14 days left |
Set it up, step by step
- Add uptime checks. Check the home page, a dynamic page and one API route every minute, each with a keyword that only appears when it really works.
- Turn on OpenTelemetry. Create
instrumentation.ts, register the Node SDK with an OTLP exporter, and setOTEL_SERVICE_NAME. See OpenTelemetry for Next.js. - Capture browser data. Add a real user monitoring script in the root layout to get Core Web Vitals and JavaScript errors per route.
- Upload source maps. So minified stack traces point at your real code.
- Alert on symptoms. Error rate and p95 latency per route, uptime, and vitals regressions after deploys.
Route alerts to the people who can act on them (Slack for warnings, a phone call for outages), and put the checks behind a status page so users see what you see.
a Next.js app specifics
Tag traces and errors with the deployment version (for example the Git commit) so a regression points at the deploy that caused it. Watch middleware separately: it runs on every matching request, so a slow call there shows up everywhere. If you deploy on Vercel, see also monitoring Vercel; self-hosted Next.js behind nginx also needs the usual server monitoring.
Does Next.js have built-in monitoring?
It has hooks (OpenTelemetry instrumentation and Web Vitals reporting) but no storage, dashboards or alerts; you connect a backend.
How do I trace server components?
Enable OpenTelemetry in instrumentation.ts; Next.js creates spans for rendering, route handlers and fetches automatically.
What should I alert on first?
Uptime of key pages, error rate of server actions and API routes, and p95 latency.
Check it now, free
- Response time checker: Measure TTFB with DNS, connect, TLS and server time.
Related reading
- Next.js performance monitoring: Monitor Next.js apps end to end: Core Web Vitals from real users, server rendering and route handler latency with OpenTelemetry, caching behaviour and errors.
- OpenTelemetry for Flask: Instrument a Flask app with OpenTelemetry, in code or with zero code: trace routes, SQLAlchemy and outgoing calls, and export to VitalRix.
- OpenTelemetry for Django: Trace a Django app with OpenTelemetry: auto-instrument views and the ORM, run under gunicorn safely, trace Celery tasks and export to VitalRix.
- Best APM tools: Choose an APM tool in 2026: the criteria that matter, from OpenTelemetry support to pricing models, well-known options compared and how to run a fair trial.
- How to monitor Firebase: How to monitor a Firebase app: Hosting uptime, Cloud Functions errors and latency, Firestore reads and costs, Authentication, Crashlytics and alerting.
- Monitoring APIs for mobile apps: Monitor the backend of a mobile app: API latency and errors per endpoint, failures by app version, push and sync jobs and regional performance.
Watch your own site and services with VitalRix
Uptime checks, APM, logs, real-user monitoring, alerts and status pages in one place. Every product has a free tier and no credit card is needed.