DEV Community

Vigilmon
Vigilmon

Posted on

How to Monitor Your pnpm Monorepo CI with Vigilmon

How to Monitor Your pnpm Monorepo CI with Vigilmon

pnpm workspaces make managing monorepos efficient, but CI pipelines in monorepos are complex. When your monorepo CI breaks, multiple packages and apps are affected. This guide shows how to use Vigilmon to monitor the services your monorepo CI deploys and the APIs that drive your build infrastructure.

What to Monitor in a pnpm Monorepo

In a pnpm monorepo, you typically have:

apps/
  web/          # frontend Next.js/Vite app
  api/          # backend Express/Fastify app
  mobile/       # React Native / Expo app
packages/
  ui/           # shared component library
  utils/        # shared utilities
  config/       # shared config (ESLint, TSConfig)
Enter fullscreen mode Exit fullscreen mode

Each deployed app in apps/ needs its own monitor. Shared packages/ don't need monitors since they're not services.

Setting Up Per-App Monitoring

Add a monitor for each deployed app:

  1. https://app.yourcompany.com — web frontend
  2. https://api.yourcompany.com/health — backend API
  3. https://staging.yourcompany.com — staging environment

Each is a separate Vigilmon monitor with its own alert settings.

Adding Health Endpoints to Each App

Next.js App in the Monorepo

// apps/web/src/app/api/health/route.ts
export async function GET() {
  return Response.json({
    status: 'ok',
    app: 'web',
    version: process.env.npm_package_version,
  });
}
Enter fullscreen mode Exit fullscreen mode

Express API App

// apps/api/src/routes/health.ts
import { Router } from 'express';

const router = Router();

router.get('/health', (req, res) => {
  res.json({
    status: 'ok',
    app: 'api',
    uptime: process.uptime(),
  });
});

export default router;
Enter fullscreen mode Exit fullscreen mode

Fastify API App

// apps/api/src/app.ts
fastify.get('/health', async (request, reply) => {
  return {
    status: 'ok',
    app: 'api',
  };
});
Enter fullscreen mode Exit fullscreen mode

Monitoring CI Artifacts with Vigilmon

If your pnpm monorepo CI pipeline deploys preview environments for each PR, you can monitor them too. Most CI platforms give a predictable URL pattern:

  • Vercel: https://pr-123-yourapp.vercel.app
  • Netlify: https://deploy-preview-123--yourapp.netlify.app
  • Railway: https://yourapp-pr-123.up.railway.app

You can auto-create Vigilmon monitors via the API when a preview deploys:

#!/bin/bash
# In your CI deploy script (GitHub Actions, CircleCI, etc.)

PREVIEW_URL="$PREVIEW_DEPLOY_URL"

curl -X POST https://vigilmon.online/api/monitors \
  -H "Authorization: Bearer $VIGILMON_API_KEY" \
  -H "Content-Type: application/json" \
  -d "{
    \"url\": \"$PREVIEW_URL\",
    \"name\": \"PR Preview - $PR_NUMBER\",
    \"interval\": 5,
    \"alertChannels\": [\"$SLACK_WEBHOOK_ID\"]
  }"
Enter fullscreen mode Exit fullscreen mode

Then delete the monitor when the PR closes:

# In your CI cleanup step
curl -X DELETE "https://vigilmon.online/api/monitors/$MONITOR_ID" \
  -H "Authorization: Bearer $VIGILMON_API_KEY"
Enter fullscreen mode Exit fullscreen mode

Monitoring Shared Package Registry

If your pnpm monorepo publishes packages to a private npm registry (Verdaccio, GitHub Packages, Artifactory), monitor the registry health:

Monitor URL: https://registry.yourcompany.com/-/ping
Expected status: 200
Keyword check: "{}"`
Enter fullscreen mode Exit fullscreen mode

A down registry means all your CI jobs that run pnpm install will fail.

Monitoring Turborepo Remote Cache

If you use Turborepo's remote cache (self-hosted or Vercel), monitor the cache server:

Monitor URL: https://your-turbo-cache.com/v8/artifacts/status
Expected status: 200
Enter fullscreen mode Exit fullscreen mode

Cache server downtime means slower builds (no cache hits), but pipelines still work. Good to know but not critical.

GitHub Actions Workflow Monitoring with Vigilmon

You can't directly monitor GitHub Actions, but you can monitor what your workflows deploy. After each successful deploy, have the workflow post to Vigilmon's API to confirm the deployment:

# .github/workflows/deploy.yml
- name: Notify Vigilmon of deployment
  if: success()
  run: |
    curl -X POST https://vigilmon.online/api/heartbeats/${{ secrets.VIGILMON_HEARTBEAT_ID }} \
      -H "Authorization: Bearer ${{ secrets.VIGILMON_API_KEY }}"
Enter fullscreen mode Exit fullscreen mode

This is a "heartbeat" monitor — if Vigilmon doesn't receive a ping within the expected window, it alerts you that the deployment pipeline stopped running.

Recommended Monitor Setup for a pnpm Monorepo

Monitor URL Interval Alert Priority
Production web https://app.com 1 min Critical
Production API https://api.com/health 1 min Critical
Staging web https://staging.app.com 5 min Warning
npm registry https://registry.com/-/ping 5 min Warning
CI heartbeat (heartbeat monitor) 1 hour Info

Alert Channels

For a monorepo team, set up:

  • Slack #incidents for production alerts
  • Slack #staging for staging alerts
  • PagerDuty for production after-hours

Summary

In a pnpm monorepo, monitoring the deployed apps is more important than monitoring the monorepo structure itself. Add /health endpoints to each app in apps/, monitor them with Vigilmon, and optionally use the Vigilmon API to create/destroy preview environment monitors in CI.

Start free at vigilmon.online.

Top comments (0)