This site is not affiliated with or endorsed by Cloudflare, Inc. It simply showcases experiments built using Cloudflare services.
Cloudflare Experiments

Uptime Monitor Alerts

Persistent URL monitors with D1 history, cron checks, and email alerts on downtime

Extend the is-it-down pattern into a persistent monitor. Cron pings registered URLs, logs checks to D1, and sends email alerts when a URL transitions from up to down.

Features

  • POST /monitors - register URL + alert email
  • DELETE /monitors/:id - remove monitor
  • GET /monitors/:id/history - check history and uptime percentage
  • Scheduled checks every 5 minutes

API Reference

POST /monitors

{ "url": "https://example.com", "alertEmail": "you@example.com" }

DELETE /monitors/:id

Remove a monitor.

GET /monitors/:id/history

Returns check history and uptime percentage.

Error Codes

  • 400 - INVALID_URL, INVALID_EMAIL, INVALID_BODY
  • 404 - NOT_FOUND

Use Cases

  • Lightweight uptime monitoring for side projects
  • Learn Cron + D1 + send_email alert patterns on Workers
  • Track uptime percentage over time for SLA reporting

Limitations

  • Requires D1, Cron, and send_email bindings configured for your domain
  • 5-minute check interval; not sub-minute alerting
  • Single-region edge checks; not global multi-PoP consensus

Deployment

Configure bindings

D1 DB, send_email binding EMAILER, cron */5 * * * *. Configure allowed sender/destination addresses in wrangler.

Test your deployment

See the experiment README for curl examples.

Local Development

cd apps/experiments/uptime-monitor-alerts
npm install
npm run dev

Configuration

D1 DB, send_email binding EMAILER, cron */5 * * * *. Configure allowed sender/destination addresses in wrangler.

Cloudflare Features Used

On this page