heartbeat
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Viewing readonly version of main branch: v55View latest version
Monitors a home server and sends a Pushcut notification if it goes offline.
- The home server pings
POST /heartbeatevery 15 minutes with a secret key monitor.tsruns every 15 minutes and checks if a heartbeat has been received in the last hour- If not, a Pushcut notification is sent via
NOTIFY_SERVER_DOWN_URL - The status page at
/renders the current state server-side — no client-side JS
| Variable | Description |
|---|---|
SECRET_KEY | Required on all heartbeat requests via x-secret-key header |
NOTIFY_SERVER_DOWN_URL | Pushcut webhook URL to call when the server is down |
Add this to your home server's crontab:
*/15 * * * * curl -X POST https://halffullheartbeat.val.run/heartbeat -H "x-secret-key: YOUR_SECRET_KEY"
main.ts— Hono HTTP server; serves the status page and accepts heartbeatsmonitor.ts— Interval val that checks for downtime and triggers notifications