How to Monitor Your Deno Application with Vigilmon
Deno is a secure TypeScript runtime gaining fast adoption. This guide shows you how to add uptime monitoring to your Deno app with Vigilmon.
Health Endpoint with Oak Framework
import { Application, Router } from 'https://deno.land/x/oak@v12.6.1/mod.ts';
const router = new Router();
router.get('/health', (ctx) => {
ctx.response.body = {
status: 'ok',
runtime: 'deno',
version: Deno.version.deno,
timestamp: new Date().toISOString(),
};
});
const app = new Application();
app.use(router.routes());
app.use(router.allowedMethods());
await app.listen({ port: 8000 });
Health Endpoint with Hono
import { Hono } from 'npm:hono';
const app = new Hono();
app.get('/health', (c) => c.json({ status: 'ok', ts: new Date().toISOString() }));
Deno.serve(app.fetch);
Health Endpoint with Fresh Framework
// routes/health.ts
import { Handlers } from '$fresh/server.ts';
export const handler: Handlers = {
GET(_req) {
return new Response(
JSON.stringify({ status: 'ok' }),
{ headers: { 'Content-Type': 'application/json' } }
);
},
};
Deno KV Health Check
If you use Deno KV, include it in your health check:
router.get('/health', async (ctx) => {
const checks: Record<string, string> = {};
try {
const kv = await Deno.openKv();
await kv.set(['health_probe'], 'ok');
const entry = await kv.get(['health_probe']);
checks.kv = entry.value === 'ok' ? 'ok' : 'miss';
} catch {
checks.kv = 'error';
}
const allOk = Object.values(checks).every(v => v === 'ok');
ctx.response.status = allOk ? 200 : 503;
ctx.response.body = { status: allOk ? 'ok' : 'degraded', checks };
});
Add to Vigilmon
- Deploy your app (Deno Deploy, Fly.io, or VPS)
- Go to vigilmon.online
- Click Add Monitor and enter your health URL
- Set interval: 1 minute
- Add email or Slack alerts
Deno Deploy Monitoring
If you use Deno Deploy, your app URL is https://your-app.deno.dev. Vigilmon monitors this external endpoint from multiple global locations, catching incidents even when Deno Deploy's own status page is delayed.
Start free at vigilmon.online — no credit card required.
Top comments (0)