Error Monitoring Ready
Ship with an error-capture abstraction and existing call sites so you can wire Sentry (or another provider) without refactoring business logic.
Overview
The starter includes an explicit error-capture boundary so monitoring can be enabled quickly without changing feature logic.
apps/web/src/lib/error-handling/error-capture.ts exports captureException(...) and captureMessage(...) as no-op functions, with inline guidance to replace them with a provider implementation (for example Sentry).
What is already implemented
Central capture API
The capture entry point lives in:
apps/web/src/lib/error-handling/error-capture.ts
Because feature modules import this wrapper rather than a vendor SDK directly, you can add or swap providers in one place.
Existing error call sites
Current production-path code already reports exceptions through the wrapper:
apps/web/src/proxy/cmsRedirects.tscatches redirect-resolution failures and callscaptureException(error).apps/web/src/features/redirects/resolveCmsRedirect.tscatches query/path merge failures and callscaptureException(error).
This means redirect-path faults are already instrumented at source once you wire a provider.
How to enable a provider (example: Sentry)
- Install and configure your provider in
apps/web(for Sentry, follow Next.js SDK setup). - Implement the wrapper in
apps/web/src/lib/error-handling/error-capture.ts:- map
captureException(error)to the provider exception API - map
captureMessage(message, severity)to the provider message API
- map
- Keep the wrapper function signatures stable so existing feature imports remain unchanged.
Practical enterprise guidance
- Add request context (route, site/language, user/session identifiers where appropriate) in the wrapper before forwarding events.
- Keep PII and secret redaction in the wrapper, not spread across feature modules.
- Use
captureMessage(...)for operational warnings that are not thrown errors, so product teams can alert on leading indicators. - Add release/environment tags centrally to support rollout and regression analysis.
Last updated: 27 Apr 2026, 14:59:48
Code Quality and Scalable Repository Structure
Maintain quality at scale with workspace boundaries, shared tooling packages, generated types, and CI gates that enforce linting, tests, and type safety.
Observability Tooling Ready
Enable Vercel Analytics, Speed Insights, and GTM via config and environment flags, with draft-mode safeguards and shared app logging.
