Build Healthchecks.io
YESreplaces $20/mosaves $240/yrback to the verdict
A heartbeat monitor for cron jobs: each job pings a URL when it finishes, the monitor calls it late and then down when the pings stop, one chat message per state change, and a dashboard with a 24-hour histogram. Healthchecks.io itself is open source, so self-hosting it is the fuller answer; this is the 300-line version you understand completely.
Before step 1
Everything below is assumed from the first step. Tick each one when you actually have it, not when you plan to.
- installfree
Why Everything in this build runs on it: the server, the scripts, the tests.
Get it Download the LTS installer from nodejs.org, or install with your package manager (brew install node, or nvm install 22). Restart the terminal afterwards. open ↗
Verify
node --version prints v22 or higher - installfree
Why Every step below is a command you type or a file you edit.
Get it VS Code (code.visualstudio.com), Cursor or Zed. Open a folder for the project and use the editor's built-in terminal. open ↗
Verify
You can open a folder and run a command in its terminal - installfree
Why History for your code, and the way most hosts deploy.
Get it Install from git-scm.com or with your package manager, then run git init in the project folder once it exists. open ↗
Verify
git --version prints a version - API keyfree
Why Alerts go to a chat channel you already watch. A webhook URL is the only credential this needs.
Get it Discord: Server settings > Integrations > Webhooks > New Webhook, copy the URL. Slack: create an app at api.slack.com/apps, enable Incoming Webhooks, add to a channel, copy the URL. Telegram: create a bot with @BotFather and use the bot token plus your chat id. open ↗
Verify
curl -X POST -H 'Content-Type: application/json' -d '{"content":"test"}' <url> posts a message (Discord form; Slack uses a text field) - have readyfree
Why Each check needs a period and a grace time; deciding them makes Phase 2 testable.
Get it crontab -l on every machine; write down name, schedule and how late is too late.
- accountabout $5 a month
Why This needs one process running all the time with a public address. The monitor must live somewhere other than the machines running the jobs.
Get it Hetzner Cloud (from about 4 EUR), DigitalOcean or Fly.io. Ubuntu 24.04, the smallest size. You need SSH access and a public IP. Only needed for the deploy phase; develop locally first. open ↗
- accountroughly $10 a year, or free on an existing domain
Why Stable ping URLs that survive a server move.
Get it Register at Cloudflare Registrar, Porkbun or Namecheap, or use a subdomain of one you already own. You add one DNS record in the deploy phase. open ↗
- installfree
Why Automatic HTTPS in front of the Node process. Without TLS the browser features this relies on (and your visitors' trust) do not work.
Get it On the VPS: follow the install steps at caddyserver.com/docs/install for Ubuntu. One Caddyfile with your domain and a reverse_proxy line is the whole config. open ↗
Verify
caddy version prints a version on the server
Data model
Create these before the first phase that stores anything. Changing a table later is the expensive kind of change.
- checks: id (uuid), name, period_seconds, grace_seconds, status ('new' | 'up' | 'late' | 'down' | 'paused'), last_ping_at, last_started_at, last_duration_ms
- pings: id, check_id, received_at, kind ('start' | 'success' | 'fail' | 'log'), exit_code, body
- alerts: id, check_id, from_status, to_status, sent_at, delivered, error
All timestamps are UTC epoch milliseconds · a local-time string breaks the late maths across a DST change.Environment variables
These go in a .env file the app reads at startup. The pack's .env.example is this table as a file · copy it, never commit the filled-in version.
| Variable | Needed | Example | Where the value comes from |
|---|---|---|---|
PORT | required | 3000 | Any free port; Caddy proxies to it. |
DATABASE_PATH | required | ./data/checks.db | SQLite file. |
ALERT_WEBHOOK_URLsecret | required | https://hooks.slack.com/services/... | Chat webhook from the prerequisites. |
ALERT_FORMAT | required | slack | discord, slack or telegram. |
SITE_URL | required | https://hc.yourdomain.com | Public base URL printed in ping URLs. |
RETENTION_DAYS | optional | 30 | How long pings are kept. |
ADMIN_USER | required | admin | Any username for the basic-auth admin pages. |
ADMIN_PASSsecret | required | change-me-to-a-long-random-string | Generate one: openssl rand -base64 24. Never reuse a real password. |
The build, in order
Ping ingestion
Accept pings on the Healthchecks scheme so existing crontab snippets port unchanged.
checks (id uuid, name, period_seconds, grace_seconds, status, last_ping_at, last_started_at, last_duration_ms), pings (id, check_id, received_at, kind, exit_code, body), alerts (id, check_id, from_status, to_status, sent_at, delivered, error). UTC epoch milliseconds throughout.
terminalmkdir heartbeats && cd heartbeats && git init && npm init -y && npm pkg set type=module mkdir -p data && cp .env.example .env
0 is success, 1-255 failure. Store at most 100 kB of body. Always answer 200 OK; unknown uuids 404.
- terminal
node scripts/add-check.mjs "nightly backup" 86400 1800
done when · tick each as it passeswatch out- Never local-time strings for timestamps; the late maths breaks across DST.
State machine
up, late, down, computed every 30 seconds, one alerts row per transition.
done when · tick each as it passesAlerting
One message per state change with retries that never stall the loop.
done when · tick each as it passesDashboard
Manage checks in the browser and see every job at a glance.
done when · tick each as it passesHardening and deploy
Rate limits, retention, HTTPS, a real crontab.
README: the one-liner with && curl -fsS, the /start and /fail wrapper, the same-host warning, and a line that Healthchecks.io is open source if you outgrow this.
Files
README.mddeploy/heartbeats.serviceCaddyfileterminal# */5 * * * * /path/job.sh && curl -fsS https://hc.yourdomain.com/ping/<uuid>
done when · tick each as it passesOperate it like a productproduct builder
Only for the product-builder path: know when the monitor itself is down, never lose the database, and keep the server patched.
Answer 200 with the build id and a quick database read. Point a free uptime monitor (or your own, from the Healthchecks entry on this site) at it so an outage is noticed before a user notices.
One JSON line per request: method, path, status, duration, no raw IPs. Rotate weekly with logrotate, keep eight.
SQLite's .backup command makes a consistent copy while the app runs. Copy it to object storage or a second machine; then, once, restore it into a fresh checkout and confirm the app reads it.
terminalsqlite3 data/app.db ".backup '/tmp/app-$(date +%F).db'" rclone copy /tmp/app-$(date +%F).db remote:backups/
Firewall allowing only 22, 80 and 443; unattended security updates on; the app running as an unprivileged user under systemd with Restart=on-failure.
done when · tick each as it passes
That is the whole plan for Healthchecks.io. What it deliberately does not cover is below · check the gaps before you call it a replacement.
- SMS, WhatsApp and phone-call alerts.
- Teams, projects and the integrations catalogue.
- Being off your infrastructure by itself: put it on a different box.
- SMS, WhatsApp and phone-call alerts
- a monitor that lives off your infrastructure
- the integrations catalogue (PagerDuty, Opsgenie, Slack app)
- team accounts and project sharing
- A second alert channel behind the Notifier interface
- A read-only status page from the checks table
Need the files? The project pack on the verdict page hands your agent the whole brief · more cron monitoring.