Sentry error tracking and performance monitoring for Next.js 15 frontend and FastAPI backend. Use this skill when adding error handling, setting up Sentry integration, instrumenting API routes or server actions, tracking database performance, or adding custom spans. Also trigger when the user mentions 'Sentry', 'error tracking', 'error monitoring', '에러 추적', '에러 모니터링', 'capture exception', or wants to add observability to any part of the application.
Unified error tracking guide for the project's dual-stack architecture: Next.js 15 (frontend) + FastAPI (backend). Each stack uses its own Sentry SDK with different initialization and capture patterns.
| Stack | SDK | Reference |
|---|---|---|
| Next.js 15 (App Router) | @sentry/nextjs v8 | nextjs-sentry.md |
| (async Python) |
sentry-sdk[fastapi] v2 |
| fastapi-sentry.md |
Read the reference for your target stack. The patterns below are cross-cutting principles that apply to both.
npm install @sentry/nextjs
# Or use the wizard:
npx @sentry/wizard@latest -i nextjs
Key files: instrumentation-client.ts, instrumentation.ts, sentry.server.config.ts, next.config.ts
pip install "sentry-sdk[fastapi]"
Single init call — integrations auto-activate:
import sentry_sdk
sentry_sdk.init(
dsn=settings.SENTRY_DSN,
environment=settings.ENVIRONMENT,
traces_sample_rate=0.1,
send_default_pii=True,
)
Both SDKs auto-capture unhandled exceptions. Manual capture is needed when you catch an error and return a graceful response:
# FastAPI