How to Monitor Your Turborepo and Monorepo Applications with Vigilmon
Running a monorepo with Turborepo means you have multiple apps and services all in one repo — but that also means multiple services to monitor. This guide covers how to add uptime and heartbeat monitoring to every service in your Turborepo workspace with Vigilmon.
The Monorepo Monitoring Challenge
A typical Turborepo workspace might have:
-
apps/web— Next.js frontend -
apps/api— Express or Fastify backend API -
apps/docs— Documentation site (Nextra, Astro) -
packages/workers— Background job processing
Each of these needs its own monitor. Vigilmon lets you set up monitors for all of them from one dashboard.
Step 1: Identify Your Services
For monitoring purposes, you care about services that expose HTTP endpoints in production:
apps/
web/ → https://yourdomain.com
api/ → https://api.yourdomain.com/health
docs/ → https://docs.yourdomain.com
Step 2: Add Health Check Endpoints to Each App
Next.js App (apps/web)
// apps/web/app/api/health/route.ts
export async function GET() {
return Response.json({
status: "ok",
service: "web",
timestamp: Date.now()
});
}
Express API (apps/api)
// apps/api/src/routes/health.ts
import { Router } from "express";
const router = Router();
router.get("/health", (req, res) => {
res.json({ status: "ok", service: "api", timestamp: Date.now() });
});
export default router;
Fastify API
fastify.get("/health", async () => {
return { status: "ok", service: "api", timestamp: Date.now() };
});
Step 3: Set Up Vigilmon Monitors
Go to vigilmon.online and add a monitor for each service:
| Service | URL | Check Interval |
|---|---|---|
| Frontend | https://yourdomain.com |
1 min |
| API | https://api.yourdomain.com/health |
1 min |
| Docs | https://docs.yourdomain.com |
5 min |
Step 4: Heartbeat Monitoring for Background Workers
Use heartbeat monitoring for cron jobs and background workers in your monorepo:
// packages/workers/src/jobs/daily-report.ts
import cron from "node-cron";
const HEARTBEAT_URL = process.env.VIGILMON_HEARTBEAT_URL!;
cron.schedule("0 9 * * *", async () => {
try {
await runDailyReport();
await fetch(HEARTBEAT_URL); // confirm job ran
} catch (error) {
console.error("Job failed:", error);
// No heartbeat = Vigilmon alerts you
}
});
Create a heartbeat monitor in Vigilmon with a 25-hour period. If the ping doesn't arrive within 25 hours, you get an alert.
Step 5: Monitor Multiple Deployment Targets
If your monorepo deploys to different platforms:
apps/web → Vercel
apps/api → Railway
apps/docs → Cloudflare Pages
Each deployment gets its own Vigilmon monitor. Group them under one status page so stakeholders see all services at once.
Alert Routing in a Monorepo Team
Use per-monitor alert routing to avoid alert fatigue:
- Frontend alerts → frontend Slack channel
- API alerts → backend Slack channel
- Background job alerts → data team Slack channel
Summary
- Add
/healthendpoints to each app in your workspace - Create one Vigilmon monitor per service
- Add heartbeat monitors for cron jobs and background workers
- Route alerts to the right team per service
Total setup time: under 15 minutes for a full Turborepo workspace.
Vigilmon — multi-region uptime and heartbeat monitoring for modern stacks. Free plan available.
Top comments (0)