How to Monitor Your KeystoneJS Application with Vigilmon
KeystoneJS is a powerful headless CMS and application framework for Node.js — built on top of GraphQL, Prisma, and Next.js. When your Keystone backend goes down, your content management system stops working and your frontend goes dark. Here's how to monitor KeystoneJS with Vigilmon.
What Can Go Wrong with KeystoneJS
Keystone is a complex stack: Node.js process + PostgreSQL/SQLite + GraphQL API + Admin UI. Failure points include:
- Node.js process crash
- Database connection failure
- GraphQL schema initialization error
- Memory exhaustion (Node.js heap overflow)
- Port binding conflicts on restart
- Prisma migration state mismatch
External monitoring catches failures regardless of their cause.
The Built-In Keystone Health Endpoint
Keystone 6 exposes a built-in health check:
GET /_healthcheck
This returns { status: 'pass' } with HTTP 200 when Keystone is running. No configuration needed — just use this endpoint.
Setting Up Vigilmon
- Sign up at vigilmon.online
- Click Add Monitor
- Configure:
-
URL:
https://your-keystone-app.com/_healthcheck - Check interval: 1 minute
- Expected status: 200
-
Keyword check:
"status":"pass"
-
URL:
- Set up alert channels (email, Slack, webhook)
Vigilmon will check your Keystone instance every 60 seconds and alert you immediately if it goes down.
Monitor the GraphQL API
The Admin UI might be down but your GraphQL API could still work (or vice versa). Add a second Vigilmon monitor for your API:
POST /api/graphql
Content-Type: application/json
{ "query": "{ __typename }" }
Vigilmon supports POST monitors with custom request bodies. Configure it to check for "data":{"__typename":"Query"} in the response.
Add a Custom Health Check with DB Verification
For deeper monitoring, add a custom route in your Keystone config:
// keystone.ts
import { config } from '@keystone-6/core';
export default config({
// ... your Keystone config
server: {
extendExpressApp: (app, commonContext) => {
app.get('/health/deep', async (req, res) => {
try {
// Check DB connectivity
const context = await commonContext.withRequest(req, res);
await context.prisma.$queryRaw`SELECT 1`;
res.json({
status: 'ok',
db: 'connected',
timestamp: new Date().toISOString()
});
} catch (err) {
res.status(503).json({
status: 'error',
db: 'disconnected',
error: err.message
});
}
});
}
}
});
Then add a Vigilmon monitor for /health/deep with keyword check "db":"connected".
Monitor the Admin UI Separately
Keystone's Admin UI is a Next.js app served at /. Monitor it separately:
-
Monitor 1:
https://your-cms.com/_healthcheck(API health) -
Monitor 2:
https://your-cms.com/(Admin UI available)
If Monitor 1 is up but Monitor 2 is down, your API is fine but the CMS UI has a problem.
Deployment Monitoring
After deploying a Keystone update, Prisma migrations run automatically. Monitor for this:
- Set up a webhook alert in Vigilmon pointing to your Slack channel
- After deploys, watch Vigilmon's response time graph — a slow startup (>10s) might indicate a migration is running
SSL and Domain Monitoring
Vigilmon automatically checks SSL certificates on your Keystone domains. You'll get alerts 30, 14, and 7 days before expiry — essential if you're running Keystone on a custom domain.
Summary
Keystone's /_healthcheck endpoint makes setup trivial. Add it to Vigilmon in 5 minutes and get 60-second uptime checks, database health monitoring, SSL expiry alerts, and instant notifications when your CMS goes down.
Start free at vigilmon.online — no credit card required.
Top comments (0)