Skip to main content
Monitoring helps you see production errors after your app is live. Sentry is optional in this repo and only turns on when you provide a DSN. If you skip it, the app works perfectly fine.

What Sentry Does for You

  • See frontend and backend errors in one place
  • Inspect full stack traces
  • Track runtime problems after deployment
  • Catch issues before your users report them (or don’t report them)

Get It Running

1

Create a Sentry project

Sign up at sentry.io and create a new project for your app.
2

Add the DSN

Copy your project DSN and add it to .env.local:
NEXT_PUBLIC_SENTRY_DSN=https://[email protected]/0
You can also set the server-side DSN (falls back to NEXT_PUBLIC_SENTRY_DSN if missing):
SENTRY_DSN=https://[email protected]/0
3

Optional: Enable source maps

For nicer production stack traces, add these build-time variables:
SENTRY_AUTH_TOKEN=your-auth-token
SENTRY_ORG=your-org
SENTRY_PROJECT=your-project
4

Optional: Tune runtime settings

Control the environment label and trace sampling:
NEXT_PUBLIC_SENTRY_ENVIRONMENT=production
SENTRY_ENVIRONMENT=production
NEXT_PUBLIC_SENTRY_TRACES_SAMPLE_RATE=0.1
SENTRY_TRACES_SAMPLE_RATE=0.1
5

Restart and trigger a test error

Restart the app (or redeploy in production) and trigger a test error to confirm Sentry receives it.

Verify It Works

Your Sentry setup is working if:
  • The app still builds normally
  • Sentry initializes when a DSN is set
  • A test error appears in your Sentry project dashboard
Did you restart the app or redeploy? Sentry won’t initialize until the new env vars are loaded.
You need the source map env vars (SENTRY_AUTH_TOKEN, SENTRY_ORG, SENTRY_PROJECT) for readable production stack traces.
Double-check that your DSN matches the correct Sentry project. Each project has a unique DSN.