Monitoring Setup
When to Use This Skill
- Need to set up error tracking (Sentry)
- Want to configure Google Analytics
- Need monitoring for production applications
- Want to track application errors and user behavior
Sentry Setup
NestJS Backend
- Install:
bun add @sentry/node @sentry/profiling-node - Initialize in
main.tsbefore app creation - Configure DSN via
SENTRY_DSNenvironment variable - Set appropriate sample rates for production
Next.js Frontend
- Install:
bun add @sentry/nextjs - Run:
bunx @sentry/wizard@latest -i nextjs - Configure client/server/edge configs
- Set
NEXT_PUBLIC_SENTRY_DSNfor client-side
Google Analytics Setup
Next.js Setup
- Add Google Analytics script to root layout
- Use
NEXT_PUBLIC_GA_MEASUREMENT_ID(format: G-XXXXXXXXXX) - Create analytics utility functions for event tracking
- Set up page view tracking
Common Events
- User signup/login
- Purchases/conversions
- Feature usage
- Custom business events
Best Practices
- Use different DSNs for dev/prod
- Set appropriate sample rates
- Respect user privacy (GDPR/CCPA)
- Don't track sensitive data
- Set up alerts for critical errors
Integration
This skill integrates with /monitoring-setup command for automated setup workflows.