Skip to content

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 fetch or 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 revalidatePath did not run.
  • Large JavaScript bundles hurting LCP and INP on mobile.

What to monitor

SignalHow to measure itAlert when
Uptime of the main pages and APIHTTP check every minute from several regions, with a keyword assertionTwo regions fail in a row
Server render and API latencyOpenTelemetry traces from `instrumentation.ts`p95 above your target for 10 minutes
Core Web Vitals (LCP, INP, CLS)Real user monitoring script on every pagep75 LCP over 2.5 s or INP over 200 ms for a day
JavaScript and server errorsError tracking from traces and the browserA new error type, or a spike after a deploy
Freshness of ISR pagesKeyword check for content that should changeExpected text missing
Certificate and domain expirySSL check with each uptime checkUnder 14 days left

Set it up, step by step

  1. 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.
  2. Turn on OpenTelemetry. Create instrumentation.ts, register the Node SDK with an OTLP exporter, and set OTEL_SERVICE_NAME. See OpenTelemetry for Next.js.
  3. Capture browser data. Add a real user monitoring script in the root layout to get Core Web Vitals and JavaScript errors per route.
  4. Upload source maps. So minified stack traces point at your real code.
  5. 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.

Frequently asked questions

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

  • 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.