01Work02About03Experience04Writing05Contact
moaz007malik@gmail.com
LinkedIn ↗GitHub ↗
Have something in mind?Let's connect →
Lahore, Pakistanmoaz007malik@gmail.comLinkedIn ↗GitHub ↗© 2026 Moaz Munawar. All rights reserved.
← All postsSeptember 10, 2024 · 5 min read

Building a Keep-Alive Uptime Monitoring System in Node.js

How I built a lightweight uptime monitoring system to keep my hobby projects alive on free-tier hosting.

Node.jsDevOpsMonitoringUptimeFree Tier

Written by

Moaz Munawar

Free-tier hosting platforms often spin down inactive applications. Here's how I built a system to keep them alive.

The Problem

Services like Render, Railway, and Heroku spin down free apps after 15-30 minutes of inactivity. This results in:

  • Slow cold starts (30+ seconds)
  • Poor user experience
  • Missed webhook deliveries

The Solution

A lightweight Node.js service that:

  1. Pings your endpoints at regular intervals
  2. Logs response times and status codes
  3. Sends alerts on failures
  4. Provides a dashboard for monitoring

Implementation

const axios = require('axios');
const cron = require('node-cron');

const endpoints = [
  'https://app1.example.com/health',
  'https://app2.example.com/api/ping',
];

cron.schedule('*/5 * * * *', async () => {
  for (const url of endpoints) {
    const start = Date.now();
    try {
      const res = await axios.get(url, { timeout: 10000 });
      console.log(`${url}: ${res.status} in ${Date.now() - start}ms`);
    } catch (error) {
      console.error(`${url}: FAILED - ${error.message}`);
      // Send alert
    }
  }
});

Hosting the Monitor

The irony is you need a host that doesn't sleep. Options:

  • GitHub Actions (cron workflow)
  • Cloudflare Workers (free tier)
  • Always-on VPS ($5/month)

Results

My free-tier apps now stay warm with consistent sub-second response times.

Newer →Next.js Performance & SEO Optimization: A Complete Guide