Setting up Sentry

Configure the built-in Sentry monitoring provider.

Sentry is the only built-in monitoring provider in this repo.

Repo Structure

The integration is split across packages:

  • packages/monitoring/api selects and loads the active provider
  • packages/monitoring/sentry contains the Sentry service and provider wrapper
  • apps/web/instrumentation.ts loads monitoring instrumentation

This repo does not configure Sentry by wrapping apps/web/next.config.ts with withSentryConfig().

Required Environment Variables

NEXT_PUBLIC_MONITORING_PROVIDER=sentry
NEXT_PUBLIC_SENTRY_DSN=https://your-dsn@sentry.io/project-id

Optional:

NEXT_PUBLIC_SENTRY_ENVIRONMENT=production
SENTRY_RELEASE=1.0.0

Key Files

  • apps/web/instrumentation.ts
  • packages/monitoring/api/src/components/provider.tsx
  • packages/monitoring/api/src/server.ts
  • packages/monitoring/sentry/src/sentry.client.config.ts
  • packages/monitoring/sentry/src/sentry.server.config.ts
  • packages/monitoring/sentry/src/services/sentry-monitoring.service.ts

Runtime Behavior

  • client code gets a Sentry-backed monitoring context through MonitoringProvider
  • server code gets a Sentry-backed service through getServerMonitoringService()
  • if no provider is configured, monitoring falls back to the console service