# Buddy CRM — Uptime Monitoring Setup

Last updated: 2026-06-09

This guide covers how to set up free uptime monitoring so you're alerted when Buddy CRM goes down, rather than finding out from users.

---

## Recommended: UptimeRobot (Free Tier)

UptimeRobot's free plan includes 50 monitors at 5-minute check intervals, email/SMS alerts, and a public status page — more than enough for this use case.

### Setup

1. **Create an account** at https://uptimerobot.com (free)

2. **Add a monitor for the main site:**
   - Monitor Type: **HTTP(S)**
   - Friendly Name: `Buddy CRM — Main Site`
   - URL: `https://sales.nownz.co.nz` (production)
   - Monitoring Interval: **5 minutes** (free-tier default)
   - Alert Contacts: Marc + (later) the second admin

3. **Add a monitor for the API:**
   - Monitor Type: **HTTP(S)**
   - Friendly Name: `Buddy CRM — API`
   - URL: `https://sales.nownz.co.nz/.netlify/functions/feature-flags`
   - This will return 401 (no auth header) which UptimeRobot treats as "up" — connection failures or 5xx are what you actually want to be alerted on

4. **Optional dependency monitors:**
   | Name | URL | What it tells you |
   |---|---|---|
   | Supabase | `https://status.supabase.com` | Platform-wide Supabase incidents |
   | Microsoft Login | `https://login.microsoftonline.com` | SSO availability |

5. **Optional public status page:** UptimeRobot → My Settings → Public Status Pages. Share the URL with the team.

---

## Alternative: Netlify Built-in Analytics

Netlify's paid plans (Pro and above) include server-side analytics with error-rate tracking. If you're on a paid plan:

1. Netlify → Site → Analytics
2. Review the "Server-side" tab for 5xx error rates
3. This doesn't send alerts but helps with post-incident analysis

---

## What Gets Monitored

| Check | Validates | Alert if... |
|---|---|---|
| Main site (HTML) | Netlify is serving pages, DNS works, SSL is valid | Site is unreachable or returns 5xx |
| API endpoint | Netlify Functions are running, Node runtime is healthy | Functions time out or crash |
| Supabase status | Platform is operational | Supabase has a major incident |
| Microsoft login | Entra ID is reachable | SSO may be affected |

### NOT monitored

- **Data correctness** — the API could return wrong data and monitoring wouldn't notice
- **Auth flow end-to-end** — monitoring can't run the full Microsoft SSO redirect
- **Individual feature failures** — if `gemini.js` is down but `feature-flags.js` is up, the basic API monitor stays green
- **Outlook sync health** — `email-sync.js` / `calendar-sync.js` may stop polling without affecting any of these checks. If you want this covered, add a synthetic monitor that hits `/.netlify/functions/sales-home` (it's read-heavy, exercises Supabase) or that posts a heartbeat job to `skill-queue` and checks for completion
- **Performance degradation** — slow-but-still-responding responses don't trigger alerts

For these you'd want application-level monitoring (e.g. Sentry for error tracking) — separate consideration.

---

## Alert Recommendations

| Severity | Channel | When |
|---|---|---|
| Site down | Email + SMS | Main site or API monitor goes down |
| External dependency down | Email only | Supabase or Microsoft status page goes down |
| Outlook sync stale (custom) | Email only | If you wire up an Outlook-sync staleness check |

Add Marc as primary, and the second admin (when appointed — see `docs/access-and-accounts.md`) as a secondary.

---

## Cost

UptimeRobot free tier: $0/month for up to 50 monitors at 5-minute intervals. More than sufficient for Buddy CRM.

Paid tier (~$7/month): 1-minute intervals, SMS alerts, advanced features. Consider only if 5-minute intervals aren't fast enough.
