Skip to content

docs: @nais/apm framework quickstarts (Next.js, React+Vite)#878

Merged
Starefossen merged 2 commits into
mainfrom
docs/framework-quickstarts
Jul 6, 2026
Merged

docs: @nais/apm framework quickstarts (Next.js, React+Vite)#878
Starefossen merged 2 commits into
mainfrom
docs/framework-quickstarts

Conversation

@Starefossen

Copy link
Copy Markdown
Member

Authors @nais/apm frontend framework quickstart guides, ordered by real navikt usage (nais/grafana-apm-app#112).

What's here

  • Next.js quickstart — the largest NAV frontend framework (56 Next repos). App Router is the primary path (initNaisAPMClient in instrumentation-client.ts, ApmErrorBoundary in the root layout + global-error.tsx, useApmRouteTracking with a <Suspense> note, opt-in tracing). Pages Router is a variant section within the same page (_app.tsx init + next/router events), covering navikt's golden-path template.
  • React + Vite quickstart — the Add link to the generated documentation #2 frontend (48 repos; Vite, not CRA). Entry-point init({ namespace }), ApmErrorBoundary, enableApmReactRouterV6(...) + <ApmRoutes> for React Router v6 (with a v7 caveat), opt-in tracing.

Both pages are nav-gated (conditional: [tenant, nav]), copy-pasteable, and cover the server-side sourcemap-resolution note and the PII/opaque-id (setUser) rule. They link into the Sentry migration guide, the sourcemap guide, trace propagation, and the APM Issues tab.

App Router vs Pages Router

Kept as one Next.js page with the App Router as the main flow and a Pages Router section for the two differences (where you init, how you track routes) — rather than two parallel pages. The existing raw-Faro setup-nextjs.md stays as the tenant-agnostic lower-level guide (ssb keeps it); its "prefer @nais/apm" tip now points at the new quickstart.

Section wiring

Updated the frontend section landing (README.md) — the nav "Get started" list and a new nav-gated framework-quickstart table in "Guides".

Dependency on #877

This branch is stacked on #877 (the Sentry migration guide) so the inbound links resolve and the build is green. Merge #877 first; the shared commit then drops out of this diff automatically.

Verification

mise run build nav ssb is green. Both quickstarts render for nav and are absent for ssb; the raw-Faro guides remain for ssb. No leftover {% %} / << >> tokens (<<tenant_url>> resolves to https://grafana.nav.cloud.nais.io/a/nais-apm-app/services). Internal links to sourcemaps, trace propagation, the migration guide, and the APM tabs resolve.

Full-migration guide (no compat shim) for frontend teams moving off
@sentry/* onto @nais/apm: concept map, copy-pasteable recipe, an honest
what's-different section (no event id, setUser PII drop, Grafana Issues
tab, server-side sourcemaps, Grafana alerts, events-tier replay,
not-yet-supported features), and a checklist. Nav-gated.
…+Vite

Add copy-pasteable @nais/apm quickstart guides ordered by real navikt usage:

- Next.js quickstart (the largest NAV frontend framework): App Router as the
  primary path (initNaisAPMClient in instrumentation-client.ts, ApmErrorBoundary,
  useApmRouteTracking, opt-in tracing) with a Pages Router variant section
  (_app.tsx + next/router events).
- React + Vite quickstart (the #2 frontend): init at the entry point,
  ApmErrorBoundary, enableApmReactRouterV6 + <ApmRoutes> for React Router v6
  (with a v7 note), opt-in tracing.

Both are nav-gated (conditional: [tenant, nav]), cover the server-side sourcemap
resolution note and the PII/opaque-id rule, and link into the Sentry migration
guide. Wire the new pages into the frontend section landing and point the
raw-Faro Next.js tip at the new quickstart.
@Starefossen Starefossen merged commit 31be1f0 into main Jul 6, 2026
6 checks passed
@Starefossen Starefossen deleted the docs/framework-quickstarts branch July 6, 2026 06:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant