tutorial

How to Monitor AppRun with Vigilmon

Add production-grade uptime monitoring to your AppRun application — health endpoint, HTTP and keyword monitors in Vigilmon, and Slack or email alerts.

How to Monitor AppRun with Vigilmon

AppRun's event-driven architecture makes it easy to build reliable, high-performance web apps. But once you've deployed, the event bus doesn't tell you when your server goes down or your latest build breaks. That's where external monitoring comes in.

This tutorial covers:

  • A /health endpoint for your AppRun app's server
  • An HTTP uptime monitor in Vigilmon
  • A keyword monitor that confirms your app renders correctly
  • Slack or email alerts when something breaks

Full setup takes about 15 minutes.


Step 1: Add a health endpoint to your server

AppRun is a client-side framework, so you need a server to host it. Here's a minimal Express server with a health route:

// server.js
import express from 'express';

const app = express();

app.get('/health', (req, res) => {
  res.json({
    status: 'ok',
    service: 'apprun-app',
    timestamp: new Date().toISOString(),
  });
});

app.use(express.static('dist'));

app.listen(3000, () => console.log('Server running on port 3000'));

Verify it works:

node server.js
curl http://localhost:3000/health
# {"status":"ok","service":"apprun-app","timestamp":"..."}

For a more thorough check that validates data sources your AppRun state depends on:

app.get('/health', async (req, res) => {
  const checks = {};
  let healthy = true;

  try {
    // check any backend API or database your AppRun state model uses
    checks.api = 'ok';
  } catch {
    checks.api = 'error';
    healthy = false;
  }

  res.status(healthy ? 200 : 503).json({
    status: healthy ? 'ok' : 'degraded',
    checks,
    timestamp: new Date().toISOString(),
  });
});

Returning 503 on failure lets Vigilmon detect outages without needing to parse the response body.


Step 2: Set up an HTTP monitor in Vigilmon

Deploy your AppRun app, then connect it to Vigilmon:

  1. Sign up at vigilmon.online — free, no card required
  2. Click New Monitor → HTTP
  3. URL: https://yourapp.example.com/health
  4. Check interval: 1 minute (paid) or 5 minutes (free)
  5. Expected status: 200
  6. Save

Vigilmon probes from multiple global regions. If your /health route returns anything other than 200 or times out, you get alerted.


Step 3: Add a keyword monitor for the app shell

Your health endpoint catches server failures. A keyword monitor catches rendering failures — for example, if your AppRun bundle fails to load or the app container never mounts.

In Vigilmon:

  1. Click New Monitor → Keyword
  2. URL: https://yourapp.example.com/
  3. Keyword: the ID or class of your AppRun mount point (e.g. id="my-app") or a static heading in the page template
  4. Match type: Contains
  5. Expected status: 200
  6. Save

If a bad deploy breaks the JS bundle but leaves the server running, only the keyword monitor catches it.


Step 4: Configure alerts

Go to Notifications → New Channel in Vigilmon and pick your delivery method:

Slack:

  1. Create an incoming webhook at api.slack.com/apps
  2. Paste the URL into Vigilmon's Slack channel config
  3. Enable it on both monitors

Email:

  1. Add your email address as a notification channel
  2. Enable it on both monitors

When your AppRun app goes down:

🔴 DOWN: yourapp.example.com/health
Status: 503
Region: EU-West
4 minutes ago

When it recovers:

✅ RECOVERED: yourapp.example.com/health
Downtime: 8 minutes

Enable both Slack and email for critical production apps.


Step 5: Heartbeat monitoring for AppRun event-driven jobs

AppRun's app.run event system can drive background jobs or scheduled workflows. If a job fails silently, HTTP monitoring won't catch it. Use a Vigilmon heartbeat:

// src/jobs/sync.js
import app from '@apprun/site';

app.on('sync-data', async () => {
  try {
    // perform data sync
    console.log('Sync succeeded');

    const heartbeatUrl = process.env.VIGILMON_SYNC_HEARTBEAT;
    if (heartbeatUrl) {
      await fetch(heartbeatUrl);
    }
  } catch (err) {
    console.error('Sync failed:', err);
  }
});

// trigger the job on a schedule
setInterval(() => app.run('sync-data'), 60_000 * 15);

In Vigilmon:

  1. Click New Monitor → Heartbeat
  2. Set the interval to match your job schedule
  3. Copy the ping URL
  4. Set VIGILMON_SYNC_HEARTBEAT=<url> in your environment

If the job misses a run, Vigilmon alerts you after one missed interval.


Step 6: Public status page

Go to Status Pages → New Status Page in Vigilmon, add your monitors, and publish. Include the URL in your app's error handling:

Something went wrong. Check our status: https://status.yourapp.example.com

Each monitor generates a live badge:

![App Status](https://vigilmon.online/badge/your-monitor-slug)

What you've built

| What | How | |------|-----| | Health endpoint | Express route at /health | | HTTP uptime check | Vigilmon HTTP monitor | | Render check | Vigilmon keyword monitor | | Slack/email alerts | Vigilmon notification channels | | Event job monitoring | Heartbeat ping after AppRun event handler | | Status page | Vigilmon public status page |

AppRun's event system makes your code reliable. Now your production visibility is reliable too.


Next steps

  • Add dedicated monitors for any REST or GraphQL endpoints your AppRun state models call
  • Watch response time trends — latency creep often precedes full outages
  • Add a heartbeat for each scheduled AppRun job or background event handler

Get started free at vigilmon.online.

Monitor your app with Vigilmon

Free plan — 5 monitors, no credit card required. Up and running in 60 seconds.

Start free →