← Back to articles

How to Set Up Monitoring for Your SaaS (2026)

Your SaaS is live. Now you need to know when things break — before your users tell you. Here's the practical monitoring stack for 2026, from zero to fully monitored.

The Monitoring Stack

You need four things:

  1. Error tracking — Know when code breaks (Sentry)
  2. Uptime monitoring — Know when your site is down (BetterStack)
  3. Logging — Know what happened (Axiom)
  4. Performance — Know when things are slow (Sentry)

Total cost: $0-50/month on free tiers. Covers most startups for the first year.

Step 1: Error Tracking with Sentry (30 minutes)

Sentry catches unhandled errors, tracks them, and alerts you.

Install

npm install @sentry/nextjs
npx @sentry/wizard@latest -i nextjs

The wizard creates config files automatically. Set your DSN:

// sentry.client.config.ts
import * as Sentry from '@sentry/nextjs'

Sentry.init({
  dsn: process.env.NEXT_PUBLIC_SENTRY_DSN,
  tracesSampleRate: 0.1, // 10% of transactions for performance
  replaysSessionSampleRate: 0.01, // 1% of sessions for replay
  replaysOnErrorSampleRate: 1.0, // 100% of error sessions for replay
})

What You Get

  • Stack traces for every error
  • User context (who was affected)
  • Session replay (watch what happened before the error)
  • Performance traces (slow database queries, API calls)
  • Release tracking (which deploy introduced the bug)

Alert Setup

Sentry → Alerts → Create Alert:

  • Condition: New issue first seen
  • Action: Send to Slack channel + email
  • Threshold: Alert immediately (don't batch)

Free tier: 5,000 errors/month. More than enough to start.

Step 2: Uptime Monitoring with BetterStack (10 minutes)

Monitor that your site is reachable from outside.

Setup

  1. Create account at betterstack.com
  2. Add monitors:
    • https://yourapp.com (homepage)
    • https://yourapp.com/api/health (API health)
    • https://yourapp.com/api/auth/session (auth service)

Health Check Endpoint

// app/api/health/route.ts
import { db } from '@/lib/db'

export async function GET() {
  try {
    // Check database connection
    await db.execute('SELECT 1')
    
    return Response.json({
      status: 'healthy',
      timestamp: new Date().toISOString(),
      checks: {
        database: 'ok',
        memory: process.memoryUsage().heapUsed,
      },
    })
  } catch (error) {
    return Response.json(
      { status: 'unhealthy', error: error.message },
      { status: 500 }
    )
  }
}

Status Page

BetterStack includes status pages. Set up at status.yourapp.com. When monitors detect downtime, the status page updates automatically.

Free tier: 5 monitors, 3-minute intervals. Plenty to start.

Step 3: Logging with Axiom (20 minutes)

Centralized logs for debugging production issues.

Install

npm install @axiomhq/js

Setup

// lib/logger.ts
import { Axiom } from '@axiomhq/js'

const axiom = new Axiom({ token: process.env.AXIOM_TOKEN })

export const logger = {
  info: (message: string, data?: object) => {
    axiom.ingest('logs', [{ level: 'info', message, ...data, timestamp: new Date() }])
  },
  error: (message: string, error?: Error, data?: object) => {
    axiom.ingest('logs', [{
      level: 'error',
      message,
      error: error?.message,
      stack: error?.stack,
      ...data,
      timestamp: new Date(),
    }])
  },
  warn: (message: string, data?: object) => {
    axiom.ingest('logs', [{ level: 'warn', message, ...data, timestamp: new Date() }])
  },
}

Usage

import { logger } from '@/lib/logger'

// In your API routes
export async function POST(req: Request) {
  const body = await req.json()
  logger.info('User signup', { email: body.email, plan: body.plan })
  
  try {
    const user = await createUser(body)
    logger.info('User created', { userId: user.id })
    return Response.json(user)
  } catch (error) {
    logger.error('Signup failed', error, { email: body.email })
    return Response.json({ error: 'Signup failed' }, { status: 500 })
  }
}

Vercel Integration

If on Vercel, use the Axiom integration (zero-code log drain):

  1. Axiom Dashboard → Integrations → Vercel
  2. Connect your Vercel account
  3. All Vercel logs automatically flow to Axiom

Free tier: 500GB ingestion/month. You'll never hit this limit as a startup.

Step 4: Performance Monitoring (Already Done)

Sentry (Step 1) includes performance monitoring with tracesSampleRate. You get:

  • API route response times
  • Database query durations
  • External API call latency
  • Web vitals (LCP, FID, CLS)

For deeper performance analysis, add:

// Track custom performance
const span = Sentry.startSpan({ name: 'heavy-computation' })
const result = await expensiveOperation()
span.end()

Step 5: Alerting Setup

Critical Alerts (Wake You Up)

  • Site down for 2+ minutes → PagerDuty/phone call
  • Error spike (10x normal rate) → Slack + SMS
  • Database unreachable → Slack + SMS

Warning Alerts (Check When Available)

  • Response time > 2s → Slack
  • Error rate > 1% → Slack
  • Disk usage > 80% → Email

Info (Log Only)

  • New user signup → Slack #growth channel
  • Payment received → Slack #revenue channel
  • Deploy completed → Slack #deploys channel

The Complete Stack

NeedToolFree TierMonthly Cost
Error trackingSentry5K errors$0
UptimeBetterStack5 monitors$0
LogsAxiom500GB ingest$0
PerformanceSentryIncluded$0
Status pageBetterStack1 page$0
Total$0

This stack is free for most startups. Upgrade when you hit limits (probably 6-12 months in).

What NOT to Monitor (Yet)

Don't set up everything on day one:

  • ❌ Infrastructure metrics (CPU, memory) — your PaaS handles this
  • ❌ Business metrics dashboards — use your analytics tool
  • ❌ Distributed tracing — overkill until you have microservices
  • ❌ Custom APM — Sentry covers the basics

Add complexity only when you have a specific problem to solve.

FAQ

Is this stack enough for production?

Yes. Sentry + BetterStack + Axiom covers 95% of monitoring needs for startups. Add complexity as you grow.

What about Datadog?

Datadog is excellent but expensive ($15+/host/month minimum). Use the free stack above until you're at 10+ engineers or need deep infrastructure monitoring.

How do I debug a production issue?

  1. Sentry alert → see the error + stack trace
  2. Click session replay → watch what the user did
  3. Search Axiom logs → find related events
  4. Check BetterStack → was there downtime?

When should I add on-call rotation?

When you have 2+ engineers and paying customers. BetterStack includes on-call scheduling in paid plans.

Bottom Line

Set up Sentry (errors), BetterStack (uptime + status page), and Axiom (logs). Total setup time: 1 hour. Total cost: $0. You'll know about problems before your users do, and you'll have the data to fix them fast.

Get AI tool guides in your inbox

Weekly deep-dives on the best AI coding tools, automation platforms, and productivity software.