← Back to projects
03 / weblive

Uptime Monitor

A full-stack uptime monitoring dashboard that checks a set of websites every 5 minutes, records HTTP status and response times, and shows uptime and latency history. Built with Next.js and PostgreSQL via Supabase, using Supabase Cron to trigger scheduled health checks.

  • Checks every 5 minutes
  • Status and latency logs
  • 24-hour uptime history
lang
TypeScript
stack
Next.jsTailwind CSSPostgreSQLSupabase

The problem

I run a few public sites, including this portfolio and a client site, and had no way to know when one went down or slowed down unless I happened to visit it. I wanted a small, self-hosted status dashboard that checks each site on a schedule and keeps a history I can look back on.

Key decisions

  • Scheduled checks with Supabase Cron (pg_cron + pg_net) instead of GitHub Actions. The database calls a protected Next.js endpoint every 5 minutes, and the endpoint URL and secret live in Supabase Vault rather than in the repo.
  • Protected the check endpoint with a bearer token, so only the scheduler can trigger a monitoring run.
  • Ran checks in parallel, with each monitor wrapped in its own error handling, so one slow or failing site never blocks or fails the whole run.
  • Treated 2xx and 3xx responses as up, enforced a 10-second timeout with AbortSignal, and recorded timeouts separately from other network errors so failures are easy to diagnose.
  • Pushed validation into PostgreSQL: check constraints on URLs and status codes, row-level security on both tables, and an index on (monitor_id, checked_at) for the dashboard's time-range queries.

Challenges

  • LinkedIn blocks automated requests, so its monitor reported false outages. I disabled it with a migration instead of deleting it, which keeps its history intact.
  • A monitor with no recent data shouldn't look healthy. If the latest check is more than 15 minutes old, the dashboard shows the status as unknown rather than showing the last result as current.
  • Check history grows by 288 rows per monitor per day. A nightly cron job deletes checks older than 90 days so the free-tier database stays small.

Results

  • Runs unattended, checking every active site every 5 minutes (288 checks per site per day).
  • The dashboard shows current status, 24-hour uptime percentage, a 24-hour history in 30-minute buckets, and response-time trends.

What's next

  • Group consecutive failed checks into downtime incidents with start and recovery times.
  • Expose a read-only status API so this portfolio can show live status for each project.