Monitoring & Logging
Maintain a high-performance, reliable application with a pre-configured observability stack. This boilerplate integrates industry-leading tools to ensure you can detect, diagnose, and resolve issues before they impact your users.
Full-Stack Error Tracking with Sentry
The boilerplate includes built-in integration with Sentry, providing real-time error monitoring and performance insights across both the client and server.
- Real-time Alerts: Get notified immediately when exceptions occur in production.
- Deep Context: Sentry captures the state of the application, including breadcrumbs and user actions leading up to an error, making debugging significantly faster.
- Performance Monitoring: Track API response times and Core Web Vitals to identify bottlenecks in your user experience.
Structured Logging with LogTape
For application-level logging, we use LogTape, a modern, lightweight logging library designed as a high-performance alternative to Pino.js.
LogTape allows you to maintain a clear audit trail of application behavior with structured data, which is essential for troubleshooting complex logic.
Usage in the Codebase
Logging is centralized via a utility library, allowing you to record events with various severity levels throughout your API routes and server components:
import { logger } from '@/libs/Logger';
export const PUT = async (request: Request) => {
// ... logic
// Structured logging for better searchability in log management tools
logger.info('Counter has been incremented');
if (error) {
logger.error('Failed to update database', { error });
}
};
Monitoring as Code with Checkly
To ensure your critical user flows are always functioning, the boilerplate incorporates Checkly. This "Monitoring as Code" approach allows you to manage your uptime checks and E2E (End-to-End) monitoring alongside your application code.
- Synthetic Monitoring: Periodically run Playwright scripts to simulate real user interactions (like login or checkout) and verify that your site is operational.
- API Monitoring: Ensure your backend endpoints are returning the correct data and meeting performance benchmarks.
- Unified Workflow: Since monitors are defined as code, they follow the same version control and code review process as your feature development.
AI-Powered Code Reviews
To maintain code quality and catch potential bugs before they even reach production, CodeRabbit is integrated into the workflow. It provides AI-powered feedback on Pull Requests, identifying logic flaws, security vulnerabilities, and optimization opportunities automatically.
Analytics with PostHog
Understand how users interact with your product using the integrated PostHog setup. It tracks page views and events automatically, even within the Next.js App Router environment, giving you the data needed to make informed product decisions.
// Automatic pageview tracking is handled via the PostHogPageView component
<SuspendedPostHogPageView />
By combining these tools, the boilerplate transforms "monitoring" from an afterthought into a core part of your development lifecycle, ensuring your SaaS remains robust as it scales.