How to Monitor Payload CMS APIs with Vigilmon (Uptime + Health Checks)
Payload CMS is a TypeScript-first headless CMS built for developers. It generates REST and GraphQL APIs from your content schema, runs on Node.js, and stores data in MongoDB or Postgres. Like any Node.js service, it can crash, run out of memory, or fail to connect to its database - and without external monitoring, you find out from your users.
Here's how to set up uptime monitoring for Payload CMS with Vigilmon.
Adding a Health Endpoint to Payload
Payload doesn't ship a built-in health endpoint, but it exposes Express.js (or Next.js in v3) routing that makes adding one simple.
Payload v2 (Express):
` ypescript
// In your payload.config.ts or server.ts
import express from 'express';
import payload from 'payload';
const app = express();
// Health check - add before payload.init()
app.get('/health', async (req, res) => {
try {
// Test DB connectivity by counting a lightweight collection
await payload.find({
collection: 'users',
limit: 0,
});
res.json({ status: 'ok', timestamp: new Date().toISOString() });
} catch (err) {
res.status(503).json({ status: 'error' });
}
});
await payload.init({
express: app,
// ...
});
`
Payload v3 (Next.js App Router):
` ypescript
// app/health/route.ts
import { getPayload } from 'payload';
import config from '@payload-config';
import { NextResponse } from 'next/server';
export async function GET() {
try {
const payload = await getPayload({ config });
// Quick DB check
await payload.find({ collection: 'users', limit: 0 });
return NextResponse.json({ status: 'ok' });
} catch (err) {
return NextResponse.json({ status: 'error' }, { status: 503 });
}
}
`
Deploy the change, then verify the endpoint responds:
`ash
curl https://your-payload-domain.com/health
{"status":"ok","timestamp":"..."}
`
Setting Up Vigilmon
- Go to vigilmon.online and create an account
- Click Add Monitor
- Type: HTTP(S)
- URL: https://your-payload-domain.com/health
- Method: GET
- Keyword check: "status":"ok"
- Check interval: 1 minute
- Alerts: Configure email, Slack, or webhook
The keyword check is critical. If your MongoDB connection fails, your health endpoint might still return HTTP 200 with an error body - the keyword check ensures Vigilmon only marks the monitor as up when the health check fully passes.
Also Monitor the Payload Admin UI
Add a second monitor for the admin panel:
- URL: https://your-payload-domain.com/admin
- Keyword check: Payload (appears in the admin page title)
- Check interval: 5 minutes
This catches frontend delivery issues separately from API failures.
Monitoring Payload's GraphQL API
If you're using Payload's GraphQL endpoint, you can monitor it with a lightweight introspection query:
- URL: https://your-payload-domain.com/api/graphql
- Method: POST
- Body: {"query":"{ __typename }"}
- Headers: Content-Type: application/json
- Keyword check: __typename
SSL Certificate Monitoring
- Add a new monitor
- Select SSL Certificate
- Enter your Payload domain
- Alert 14 days before expiry
Common Payload CMS Failure Modes Vigilmon Catches
MongoDB replica set election: Payload loses DB connection mid-operation. Health check fails, Vigilmon alerts within 1 minute.
Node.js OOM crash: Process exits. HTTP check immediately fails.
Failed deployment / compile error: TypeScript build fails, new version doesn't start. Vigilmon catches the 502 from your proxy.
Stale database migrations: Payload starts but schema mismatches cause errors on queries. Custom health check with a collection query catches this.
Recommended Setup
| Monitor | What It Checks |
|---|---|
| HTTP health endpoint | API + DB connectivity |
| Admin UI | Frontend delivery |
| GraphQL endpoint | GraphQL API layer |
| SSL certificate | TLS validity |
Multi-region checks in Vigilmon mean you're only alerted when a failure is confirmed from multiple geographic locations - not on transient network blips between Vigilmon and your server.
Start free at vigilmon.online - no credit card, first monitor live in minutes.
Top comments (0)