Dev.to WebDev 🛠 Dev 👁 0 📖 4 min read

How to Monitor Your Supabase App with Vigilmon (Free External Uptime Checks)

Supabase is one of the fastest-growing open-source Firebase alternatives. But like any cloud service, it can have downtime — and when your Supabase database or API is unavailable, your entire application stops working. E

Supabase is one of the fastest-growing open-source Firebase alternatives. But like any cloud service, it can have downtime — and when your Supabase database or API is unavailable, your entire application stops working. External monitoring gives you an early warning before your users notice.

This guide shows you how to monitor your Supabase project with Vigilmon using free external uptime checks.

What Can Fail in a Supabase-Backed App

Supabase has multiple components that can independently fail or degrade:

  • Postgres database — query timeouts, connection pool exhaustion, disk space limits
  • REST API (PostgREST) — the auto-generated REST layer can return errors even when the DB is fine
  • Auth service — GoTrue handles authentication; if it is down, users cannot sign in
  • Storage API — file uploads and downloads fail
  • Edge Functions — Deno-based functions can hit cold start issues or time out

Step 1: Create a Health Check Endpoint in Your App

The most reliable approach is to add a health check route to your own application that validates Supabase connectivity:

Next.js API Route

// pages/api/health.ts (Next.js Pages Router)
import { createClient } from '@supabase/supabase-js';
import type { NextApiRequest, NextApiResponse } from 'next';

const supabase = createClient(
  process.env.NEXT_PUBLIC_SUPABASE_URL!,
  process.env.SUPABASE_SERVICE_ROLE_KEY!
);

export default async function handler(req: NextApiRequest, res: NextApiResponse) {
  const checks: Record<string, string> = {};
  let allOk = true;

  // Check Supabase database connectivity
  try {
    const { error } = await supabase.from('_health').select('count').limit(1);
    // Use any lightweight table; if it fails with table-not-found, DB is still reachable
    checks.database = error && error.code !== 'PGRST116' ? 'error' : 'ok';
    if (checks.database === 'error') allOk = false;
  } catch (e) {
    checks.database = 'error';
    allOk = false;
  }

  res.status(allOk ? 200 : 503).json({
    status: allOk ? 'ok' : 'degraded',
    checks,
    timestamp: new Date().toISOString()
  });
}

Express.js (Node.js)

import { createClient } from '@supabase/supabase-js';

const supabase = createClient(
  process.env.SUPABASE_URL,
  process.env.SUPABASE_SERVICE_ROLE_KEY
);

app.get('/health', async (req, res) => {
  try {
    // Lightweight DB ping
    const { error } = await supabase.rpc('version');
    if (error) throw error;
    res.json({ status: 'ok', timestamp: new Date().toISOString() });
  } catch (e) {
    res.status(503).json({ status: 'error', message: e.message });
  }
});

Step 2: Monitor Supabase's Own Status URL

Supabase maintains a public status page. You can also directly monitor your project's REST API endpoint:

https://<your-project-ref>.supabase.co/rest/v1/

This endpoint returns a 200 if the PostgREST layer is up, even without authentication. Use this as a lightweight check:

Monitor URL Check
Your app health https://yourapp.com/health 200 + keyword
Supabase REST API https://xxxx.supabase.co/rest/v1/ 200

Step 3: Add Monitors in Vigilmon

  1. Go to vigilmon.online and sign up (free tier)
  2. Click Add Monitor
  3. Add your app's health endpoint: https://yourapp.com/api/health
  4. Set check interval: 1 minute
  5. Set expected status: 200
  6. Optionally add keyword check: "status":"ok"
  7. Configure alert channel (email, Slack, or webhook)
  8. Click Save

Optionally add a second monitor for the Supabase REST API directly:

  • URL: https://your-project-ref.supabase.co/rest/v1/
  • Expected status: 200

This gives you two layers of visibility: your application health, and the underlying Supabase service.

Step 4: Monitor Supabase Edge Functions

If you use Supabase Edge Functions, add a health endpoint to your function:

// supabase/functions/my-function/index.ts
import { serve } from "https://deno.land/[email protected]/http/server.ts";

serve(async (req) => {
  const url = new URL(req.url);

  if (url.pathname.endsWith('/health')) {
    return new Response(JSON.stringify({ status: 'ok' }), {
      status: 200,
      headers: { 'Content-Type': 'application/json' }
    });
  }

  // Your function logic
  return handleRequest(req);
});

Then monitor:

https://<project-ref>.supabase.co/functions/v1/my-function/health

Note: Edge Function invocations require an Authorization header. For health checks, you can use your anon key:

In Vigilmon, add a custom header: Authorization: Bearer your-anon-key

What Supabase Monitoring Should Cover

Component How to Monitor What Failure Means
Postgres DB Health check in your app that runs a SELECT Users cannot read/write data
PostgREST API GET your-project.supabase.co/rest/v1/ Auto-generated API down
Auth (GoTrue) Try a token validation in health check Users cannot sign in
Edge Functions /health endpoint in each function Serverless logic unavailable
Storage Optional: test a known-public file URL File uploads/downloads fail

Setting Up Alerts

For production Supabase-backed apps:

  • Slack — immediate team notification during incidents
  • Email — async backup notification
  • Webhook to PagerDuty — for on-call escalation on critical apps

Vigilmon's multi-region consensus approach means you will not get false alerts from single-region Supabase hiccups. An alert only fires when multiple monitoring regions independently confirm the failure.

Summary

Monitoring a Supabase-backed app with Vigilmon:

  1. Add a /health endpoint to your application that validates Supabase DB connectivity
  2. Monitor that endpoint in Vigilmon (every 1 minute, 200 expected)
  3. Optionally add a direct monitor for the Supabase PostgREST API endpoint
  4. Configure Slack/email alerts

You will know about Supabase-related downtime within 60 seconds — before your users do.

Try Vigilmon free: vigilmon.online

📰 Read the original article on Dev.to WebDev

Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.