Monitoring Your Next.js App with Vigilmon: API Routes, Edge Functions & Uptime Alerts
Next.js powers a significant portion of the modern web. Whether you are running on Vercel, a VPS, or AWS, knowing when your Next.js app is down — before your users tell you — requires external monitoring. Vigilmon makes this easy with multi-region checks and zero false alerts.
Why External Monitoring for Next.js?
Next.js apps have multiple surfaces that can fail independently:
- The main Next.js server or edge runtime
- API routes (
/api/*) - Server components (App Router)
- External dependencies (databases, CMS, auth)
Internal health metrics (CPU, memory) do not tell you when a user sees a 500 error. External monitoring does.
Setting Up Vigilmon for Your Next.js App
Step 1: Create a Health Check Route
Create /app/api/health/route.ts (App Router) or /pages/api/health.ts (Pages Router):
App Router (app/api/health/route.ts):
import { NextResponse } from 'next/server'
export async function GET() {
// Optionally add a quick DB ping here
return NextResponse.json(
{ status: 'ok', timestamp: Date.now() },
{ status: 200 }
)
}
Pages Router (pages/api/health.ts):
import type { NextApiRequest, NextApiResponse } from 'next'
export default function handler(req: NextApiRequest, res: NextApiResponse) {
res.status(200).json({ status: 'ok', timestamp: Date.now() })
}
Step 2: Add Database Check (Optional but Recommended)
For a more meaningful health check that verifies your database is reachable:
import { NextResponse } from 'next/server'
import { db } from '@/lib/db' // your Prisma/Drizzle/etc client
export async function GET() {
try {
await db.$queryRaw`SELECT 1`
return NextResponse.json({ status: 'ok', db: 'connected' })
} catch (error) {
return NextResponse.json(
{ status: 'error', db: 'disconnected' },
{ status: 503 }
)
}
}
Step 3: Add the Monitor in Vigilmon
- Sign up at vigilmon.online
- Click Add Monitor
- Enter your health check URL:
https://yourdomain.com/api/health - Set check interval: 1 or 5 minutes
- Add alert channels: email, webhook, or both
- Click Save
Vigilmon immediately starts checking from multiple regions. If the endpoint goes down in 2+ regions simultaneously, you get alerted.
Monitoring Multiple Next.js Surfaces
Add separate monitors for each critical surface:
| Monitor | URL | Why |
|---|---|---|
| App health | /api/health |
Overall server + DB status |
| Home page | / |
SSR is working |
| Auth endpoint | /api/auth/session |
Authentication not broken |
| Key API route | /api/your-main-api |
Core functionality up |
Vercel Deployments
If you deploy on Vercel, your app is globally distributed. Vigilmon still adds value because:
- Vercel's status page covers Vercel infrastructure, not your specific app code
- A broken environment variable or database issue won't show on Vercel's status page
- Vigilmon monitors the actual response from your specific deployment
For Vercel preview deployments, you can add temporary monitors with the preview URL to test before promoting to production.
Webhook Alerts for Slack/Discord/PagerDuty
Vigilmon supports webhook alerts. To send to Slack when your Next.js app goes down:
- Create a Slack incoming webhook URL in your Slack workspace settings
- In Vigilmon, add a webhook alert channel with the Slack URL
- Vigilmon posts
{ "text": "Monitor 'Your App' is DOWN" }format compatible with Slack
Setting Up a Status Page
Vigilmon includes public status pages. Share your uptime with customers:
- In Vigilmon dashboard, go to Status Pages
- Create a new status page
- Add the monitors you want to show publicly
- Share the URL:
https://status.vigilmon.online/your-page
You can embed this in your Next.js app or link from your footer.
Conclusion
External uptime monitoring is a must for any production Next.js application. Vigilmon gives you multi-region checks, smart false-alert prevention, webhook integrations, and status pages — all from a free tier.
Get started in 2 minutes at vigilmon.online. No credit card required.
Top comments (1)
The health check route in App Router looks clean with the
timestampfield for debugging, but I worry about the database ping timing out during high traffic - it might not reflect real user experience. Vigilmon's multi-region checks are smart, but I'd question if the 1-minute interval is enough for edge functions that can be slow to initialize.