DEV Community

Vigilmon
Vigilmon

Posted on

Uptime Monitoring for Elysia.js Applications with Vigilmon

Elysia is a high-performance TypeScript web framework built for Bun. It's fast, elegant, and production-ready - but running fast doesn't mean your server can't go down. Here's how to add uptime monitoring to your Elysia app with Vigilmon.

Why Elysia Apps Need Monitoring

Elysia apps run on Bun, which means:

  • No process manager overhead (often run with un start)
  • No cloud platform built-in uptime monitoring (unlike Vercel or Netlify)
  • If the Bun process dies, your app is gone - and nothing tells you

External uptime monitoring from Vigilmon fills this gap. It checks your endpoint from multiple global locations every minute, and alerts you the moment your Elysia app goes offline.

Adding a Health Check to Your Elysia App

` ypescript
import { Elysia } from "elysia";

const app = new Elysia()
.get("/health", () => ({
status: "ok",
timestamp: new Date().toISOString(),
runtime: "bun",
version: Bun.version,
}))
.get("/", () => "Hello, world!")
.listen(3000);

console.log(Elysia running at :);
`

Health Check with Dependency Verification

For apps that connect to a database or external service:

` ypescript
import { Elysia } from "elysia";
import { db } from "./db"; // your database client

const app = new Elysia()
.get("/health", async () => {
const checks: Record = {};
let healthy = true;

// Check database
try {
  await db.execute("SELECT 1");
  checks.database = "ok";
} catch {
  checks.database = "error";
  healthy = false;
}

return new Response(
  JSON.stringify({
    status: healthy ? "ok" : "degraded",
    checks,
    timestamp: new Date().toISOString(),
  }),
  {
    status: healthy ? 200 : 503,
    headers: { "Content-Type": "application/json" },
  }
);
Enter fullscreen mode Exit fullscreen mode

})
.listen(3000);
`

Vigilmon detects the 503 status and triggers your alert.

Using Elysia's Built-in Context Types

` ypescript
import { Elysia, t } from "elysia";

const healthPlugin = new Elysia({ prefix: "/health" })
.get("/", () => ({ status: "ok" }))
.get("/ready", async ({ set }) => {
// Check if app is ready to serve traffic
const dbReady = await checkDatabase();
if (!dbReady) {
set.status = 503;
return { status: "not_ready", reason: "database_unreachable" };
}
return { status: "ready" };
});

const app = new Elysia()
.use(healthPlugin)
.listen(3000);
`

Setting Up Monitoring in Vigilmon

  1. Go to vigilmon.online and sign up
  2. Click New Monitor
  3. Enter your configuration:
  4. Add alert channels (Slack, email, or webhook)

Running Elysia in Production

For production deployments, run Elysia behind a process manager to handle crashes:

With PM2

ash
pm2 start --name my-elysia-app bun -- start
pm2 save
pm2 startup

With systemd

`ini
[Unit]
Description=Elysia App
After=network.target

[Service]
Type=simple
User=www-data
WorkingDirectory=/app
ExecStart=/usr/local/bin/bun run start
Restart=on-failure
RestartSec=5s

[Install]
WantedBy=multi-user.target
`

Even with a process manager, external monitoring from Vigilmon is essential - PM2/systemd may restart your process but Vigilmon tells you it restarted and how long it was down.

Monitoring Elysia Behind a Reverse Proxy

If you're running Elysia behind nginx or Caddy, monitor the public URL (not the internal port):

`
ginx
server {
listen 443 ssl;
server_name your-app.com;

location / {
    proxy_pass http://localhost:3000;
}

# Optional: dedicated health check that bypasses rate limiting
location /health {
    proxy_pass http://localhost:3000/health;
    access_log off;
}
Enter fullscreen mode Exit fullscreen mode

}
`

Monitor: https://your-app.com/health

Recommended Alert Setup

Monitor Interval Alert
/health (liveness) 1 min Slack + email after 2 failures
/health/ready (readiness) 1 min Slack after 3 failures
SSL certificate Daily Email 30 days before expiry

What Vigilmon Catches That PM2 Misses

  • Network issues - PM2 restarts processes, but if your server's network interface goes down, PM2 doesn't know
  • Proxy failures - If nginx misconfigures and stops routing to Elysia, PM2 shows the process as running
  • Regional outages - Your Bun server might be reachable from one region but not another
  • Response content issues - Vigilmon can verify your endpoint returns specific keywords, not just a 200

Conclusion

Elysia on Bun is one of the fastest web frameworks available. But speed doesn't replace observability. Vigilmon gives your Elysia app the external monitoring it needs:

  • 1-minute check intervals
  • Multi-region consensus to avoid false alerts
  • Instant alerts via Slack, email, or webhook

Start monitoring your Elysia app for free at vigilmon.online

Top comments (0)