DEV Community

Vigilmon
Vigilmon

Posted on

How to Monitor Your Deno Application with Vigilmon

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 });
Enter fullscreen mode Exit fullscreen mode

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);
Enter fullscreen mode Exit fullscreen mode

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' } }
    );
  },
};
Enter fullscreen mode Exit fullscreen mode

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 };
});
Enter fullscreen mode Exit fullscreen mode

Add to Vigilmon

  1. Deploy your app (Deno Deploy, Fly.io, or VPS)
  2. Go to vigilmon.online
  3. Click Add Monitor and enter your health URL
  4. Set interval: 1 minute
  5. 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)