Sentry
Wire Sentry as the error reporter for both the Bun + Express server and the Next.js client. Server uses @sentry/bun, client uses @sentry/nextjs.
Status: scaffold. Fill in the sections below before publishing. The wiring exists in code; this page is the operator-facing summary.
What you get
UseDeploy's infrastructure/observability module ships Sentry as a first-class
error reporter alongside Pino logs and OpenTelemetry traces. The two SDKs are
intentionally split:
- Server:
@sentry/bun— boots before Express loads so auto-instrumentation attaches to every route. - Client:
@sentry/nextjswithinstrumentation-client.tsandinstrumentation.tsfor App Router source-map and event support.
logger.error(...) does NOT auto-capture to Sentry. Use the captureError(err, ctx)
helper for errors that should page someone — see infrastructure/observability/sentry.ts.
Setup
1. Create the projects
In the Sentry dashboard, create two projects:
- One Node project for the API server (use the
bunruntime label if available). - One Next.js project for the client.
Grab the DSN for each.
2. Set env vars
# apps/server/.env
SENTRY_DSN_SERVER="https://<key>@o<org>.ingest.sentry.io/<project>"
SENTRY_TRACES_SAMPLE_RATE=0.1
SENTRY_ENV=production
# apps/client/.env
NEXT_PUBLIC_SENTRY_DSN_CLIENT="https://<key>@o<org>.ingest.sentry.io/<project>"
SENTRY_AUTH_TOKEN=... # for source-map upload at build timeThe server boots to a no-op when SENTRY_DSN_SERVER is unset, so local dev
needs zero config.
3. Smoke test
Trigger a known error path and verify it shows up in the Sentry dashboard within
a minute. The recommended smoke test is to hit /api/v1/__diag/throw (only
mounted in non-production) and confirm both the OTel span and the Sentry event
correlate via the trace_id tag.
Where it lives in the codebase
apps/server/src/infrastructure/observability/sentry.ts— server boot + helperapps/server/src/otel-init.ts— OTel must boot before Sentry; do not reorderapps/client/instrumentation.ts+instrumentation-client.ts— Next App Router source-map and client-side init
Related
Integrations
Drop-in vendor adapters useDeploy ships out of the box. Each page is the operator's playbook for one third-party service wired to a bounded context.
UploadThing
Use UploadThing as a managed object-storage backend for the storage module without changing any application code — the storage port stays the same.