How to Monitor Your KeystoneJS Application with Vigilmon
KeystoneJS is a powerful headless CMS and application framework built on Node.js and GraphQL. Once your Keystone app is in production, you need to know the moment it goes down - before your content editors or end users notice. This guide shows you how to set up uptime monitoring, API health checks, and admin UI monitoring for your Keystone application with Vigilmon.
What to Monitor in a KeystoneJS Application
A typical KeystoneJS production setup has several components worth monitoring:
- The main application URL - your public-facing site or API endpoint
- The Admin UI - the / or /admin interface where content editors work
- The GraphQL API endpoint - typically /api/graphql
- REST API endpoints (if you've defined custom routes)
- SSL certificate - critical if running on a custom domain
- Background tasks and webhooks - if you've set up custom event handlers
Setting Up Vigilmon Monitoring for Keystone
Step 1: Create a Vigilmon Account
Go to vigilmon.online and create a free account. The free tier includes 3 monitors - enough to cover your critical Keystone endpoints.
Step 2: Monitor Your GraphQL API
KeystoneJS's core is its GraphQL API. This is the first thing to monitor.
Introspection check (simple health ping):
Add a monitor for:
https://your-keystone-app.com/api/graphql
Set the method to GET and verify the response is 200 OK.
Better: Add a Keystone health endpoint
Create a simple custom route in your Keystone config:
`javascript
// keystone.config.ts
import { config } from '@keystone-6/core'
export default config({
// ... your existing config
server: {
extendExpressApp: (app) => {
app.get('/health', (req, res) => {
res.json({
status: 'ok',
timestamp: new Date().toISOString(),
service: 'keystone'
})
})
}
}
})
`
Then monitor https://your-keystone-app.com/health with expected status 200 and keyword match "status":"ok".
Step 3: Monitor the Admin UI
The Admin UI at / (or /admin in some configurations) is where your editors work. A crash here blocks your content team.
Add a second monitor for:
https://your-keystone-app.com/
Vigilmon will alert you if the admin UI returns an error or times out.
Step 4: SSL Certificate Monitoring
Keystone apps on custom domains need valid SSL certificates. Vigilmon automatically monitors your SSL cert expiry when you add an HTTPS monitor. You'll receive alerts 30, 14, and 7 days before expiry.
Step 5: Set Up Alerting
In Vigilmon, configure:
- Email alerts for immediate notification when a monitor goes down
- Webhook alerts to notify your team's Slack channel or Discord server
json
{
"text": "?? Keystone app DOWN: {{monitor_name}} failed at {{timestamp}}"
}
Environment-Specific Setup
Keystone on Railway or Render
If you're deploying Keystone on Railway or Render, your app URL is the platform-provided domain (or your custom domain). Monitor that public URL directly.
For Railway, you'll also want to check if the DATABASE_URL connection is working. The health endpoint approach handles this:
javascript
app.get('/health', async (req, res) => {
try {
// Simple DB ping via Keystone's context
res.json({ status: 'ok', db: 'connected' })
} catch (err) {
res.status(500).json({ status: 'error', error: err.message })
}
})
Keystone on Vercel (Serverless)
If you're running Keystone in serverless mode, cold starts can cause false positives on very short check intervals. Set your Vigilmon check interval to 1 minute or longer to avoid alerting on normal cold start latency.
Keystone with a Separate Frontend
If your Keystone app serves only the API/Admin UI and a separate Next.js or Nuxt site consumes the data:
- Monitor the Keystone API endpoint separately
- Monitor the frontend URL separately
- Use status pages to communicate both to your users
Setting Up a Status Page
If your Keystone app powers a public-facing product, create a Vigilmon status page to show uptime to your users:
- In Vigilmon, go to Status Pages ? New Status Page
- Add your Keystone monitors to the page
- Share the URL with your users: status.yourdomain.com
This reduces support requests when incidents happen - users can self-serve status information instead of emailing you.
Monitoring Cron Jobs in Keystone
If you use Keystone with scheduled tasks (custom cron scripts,
ode-cron, etc.), use Vigilmon's heartbeat monitoring to verify they're completing:
- Create a Heartbeat monitor in Vigilmon
- Get the ping URL (e.g., https://heartbeat.vigilmon.online/ping/abc123)
- Ping it at the end of each successful cron run:
`javascript
// In your cron script
const axios = require('axios')
async function runDailySync() {
// ... your Keystone data sync logic
// Ping heartbeat on success
await axios.get('https://heartbeat.vigilmon.online/ping/abc123')
}
`
If the heartbeat stops arriving, Vigilmon alerts you that the job has failed silently.
Complete Monitor Setup Checklist
For a production Keystone application:
- [ ] Main application URL (/ or /api/graphql)
- [ ] Health endpoint (/health) - create one if it doesn't exist
- [ ] Admin UI accessibility
- [ ] SSL certificate expiry
- [ ] Webhook alerting to Slack/Discord
- [ ] Heartbeat monitors for any scheduled tasks
Summary
| Monitor | URL | Check Type |
|---|---|---|
| Keystone API | /api/graphql or /health | HTTP 200 |
| Admin UI | / or /admin | HTTP 200 |
| SSL cert | Your domain | SSL expiry |
| Cron jobs | Heartbeat URL | Heartbeat |
KeystoneJS is a serious platform for production applications - treat your monitoring accordingly. A 2-minute Vigilmon setup catches outages before they become support tickets.
Top comments (0)