You find out your payment flow is broken when a customer emails: "I tried to upgrade but it keeps failing." The feature stopped working two days ago.
That is the most common production bug story in early-stage SaaS -- not the crash, but the delay. By the time you know something is broken, you have already lost trust and probably a customer.
Error monitoring closes that gap. Here is how to add it to your Next.js SaaS boilerplate without signing up for another $26-per-month tool.
Sentry is the go-to recommendation, and its free tier covers most early products. But many founders skip it because it feels like one more thing to set up before they can ship.
The result: they go live with zero visibility into what breaks. When something goes wrong, they are the last to know.
The good news: if you already have Drizzle ORM, Resend, and a Next.js API route, you have everything you need to build a basic error monitoring layer that alerts you the moment something fails.
Before picking a solution, decide what level of visibility you need right now:
Most founders need Level 1 on launch day, Level 2 by the time they have paying customers, and Level 3 only when debugging becomes a full-time job.
Your boilerplate already sends transactional email via Resend. You can reuse the same emailService to fire an alert whenever an unhandled error reaches your API routes.
Add a reportError helper in lib/errors/index.ts:
export async function reportError(error: unknown, context?: string) {
if (process.env.NODE_ENV !== 'production') return;
await emailService.sendEmail({
to: process.env.ALERT_EMAIL!,
subject: `[ERROR] ${context ?? 'Unhandled error'}`,
react: React.createElement(ErrorAlertEmail, {
message: error instanceof Error ? error.message : String(error),
context,
appName: 'Your SaaS',
}),
});
}
Call reportError(error, 'POST /api/payments') inside any catch block on a critical path. Set ALERT_EMAIL to your inbox. You will get an email within seconds of a failure -- before any user has time to write a complaint.
When you have 20-30 users, a searchable error table beats an inbox full of alerts. Add a table to your Drizzle schema:
export const errorLogTable = pgTable('error_logs', {
id: uuid('id').primaryKey().defaultRandom(),
message: text('message').notNull(),
stack: text('stack'),
context: text('context'),
userId: uuid('user_id').references(() => userTable.id),
route: text('route'),
createdAt: timestamp('created_at').defaultNow().notNull(),
});
Extend reportError to write a row before sending the email. Your admin panel (see how to build an admin panel) can then render a filterable error list. Three users hitting the same failure on the same route is a signal you need to act fast -- a single row in an email is easy to miss.
An error message alone is rarely enough to fix the bug. For every error, capture:
That combination lets you find the affected user, correlate with your audit log, reproduce the request, and push a fix the same day.
Reach for Sentry or Highlight.io when:
Both have free tiers generous enough for an early-stage SaaS. Setup is one environment variable and a Next.js instrumentation file -- you do not need to rewrite your error-handling logic.
Before you go live:
ALERT_EMAIL set in environment variablesreportError() called in every catch block on auth, payment, and data-write pathserror_logs table migrated to your Neon databaseAfter your first 50 users:
You do not need a new tool to catch production failures. The Next.js SaaS boilerplate already includes Resend for email and Drizzle ORM for the database -- wire them together and you have real-time alerts before your first paying customer signs up.
Add the full observability layer when your user count makes it worth it. For now, knowing within five minutes that something broke is all you need.
Get the boilerplate and ship with visibility from day one: boilerplate.iteam-company.com