Skip to main content
Use @squasher/nextjs when you want one integration that covers server errors, route handlers, middleware, and client-rendered failures.

Install

Initialize

Create instrumentation.ts in your project root, or src/instrumentation.ts if you use a src/ layout.
instrumentation.ts
If you run an older Next.js version that requires the instrumentation hook flag, enable it in next.config.js.

Middleware

middleware.ts

Route handlers

app/api/users/route.ts

Client error boundaries

app/providers.tsx

Web Vitals

For browser-side Core Web Vitals plus Next.js framework metrics, install @squasher/browser and mount a client provider from your root layout:
app/squasher-browser-provider.tsx
app/layout.tsx
This captures LCP, CLS, INP, FCP, TTFB, plus the framework metrics Next emits via useReportWebVitals (Next.js-hydration, Next.js-route-change-to-render, Next.js-render). Each measurement is tagged with the current pathname so the Web Vitals dashboard template can group by route.
  • Upload source maps for readable production traces.
  • Use the Browser SDK if you want a framework-agnostic frontend integration instead.

Agent handoff