DEV Community

Vigilmon
Vigilmon

Posted on

How to Monitor Your Supabase App with Vigilmon (Database, Auth, and Edge Functions)

Supabase is the open-source Firebase alternative. If you are building on Supabase, your app depends on its REST API, realtime websocket connections, authentication, and storage — and any of those can fail.

This guide shows how to monitor your Supabase-backed application with Vigilmon so you know about outages before your users do.

What Can Break in a Supabase App

Supabase-backed apps have several layers that can fail independently:

  • Supabase REST API — your app's data layer; if the PostgREST API is down, queries fail
  • Realtime — websocket connections drop; live features stop updating
  • Auth — signup and login stop working
  • Storage — file uploads and downloads fail
  • Edge Functions — your serverless functions return errors
  • Supabase itself — the hosted platform can have incidents (check status.supabase.com)

Step 1: Add a Health Check API Route

If you use Next.js or another framework with API routes, create a /api/health endpoint that tests your Supabase connection:

import { createClient } from "@supabase/supabase-js";
import { NextResponse } from "next/server";

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

export async function GET() {
  const checks: Record<string, string> = {};

  // Test database connectivity
  try {
    const { data, error } = await supabase
      .from("_health_check")
      .select("count")
      .limit(1);

    // Even a "table not found" error means Supabase is reachable
    checks.database = error?.code === "PGRST116" ? "ok" : error ? `error: ${error.message}` : "ok";
  } catch (e) {
    checks.database = "unreachable";
  }

  const isHealthy = Object.values(checks).every(v => v === "ok");

  return NextResponse.json(
    { status: isHealthy ? "ok" : "degraded", checks },
    { status: isHealthy ? 200 : 503 }
  );
}
Enter fullscreen mode Exit fullscreen mode

Step 2: Monitor Your Supabase Project URL

Supabase projects expose their REST API at a known URL. You can monitor this directly:

https://your-project-ref.supabase.co/rest/v1/
Enter fullscreen mode Exit fullscreen mode

This returns 200 with the API schema. Add it to Vigilmon as a monitor.

For a more meaningful check, monitor a specific table read that requires authentication:

https://your-project-ref.supabase.co/rest/v1/your_table?select=count&limit=1
Enter fullscreen mode Exit fullscreen mode

With headers:

apikey: your-anon-key
Authorization: Bearer your-anon-key
Enter fullscreen mode Exit fullscreen mode

Configure these in Vigilmon as custom request headers.

Step 3: Monitor Supabase Auth

Create a separate monitor for your auth endpoint:

https://your-project-ref.supabase.co/auth/v1/settings
Enter fullscreen mode Exit fullscreen mode

This returns 200 when auth is healthy and includes your project's auth configuration. Add it as a monitor — no auth header needed.

Step 4: Set Up Vigilmon

  1. Sign up at vigilmon.online — free for 50 monitors, 1-minute checks
  2. Add monitors:
    • Your app health endpoint: https://yourapp.com/api/health
    • Supabase REST: https://your-project-ref.supabase.co/rest/v1/
    • Supabase auth: https://your-project-ref.supabase.co/auth/v1/settings
  3. Set alerts: Slack, email, or webhook

Monitoring Supabase Realtime

Realtime uses websockets, which Vigilmon does not directly check (it uses HTTP). To monitor realtime:

  1. Create a simple edge function that verifies realtime is enabled:
// supabase/functions/health/index.ts
import { serve } from "https://deno.land/std@0.168.0/http/server.ts";

serve(async () => {
  return new Response(
    JSON.stringify({ status: "ok", realtime: "enabled" }),
    { headers: { "Content-Type": "application/json" } }
  );
});
Enter fullscreen mode Exit fullscreen mode
  1. Deploy it and monitor https://your-project-ref.supabase.co/functions/v1/health.

Self-Hosted Supabase

If you self-host Supabase with Docker, add uptime monitors for each component:

Service Port URL to Monitor
PostgREST 3000 http://your-host:3000/
Auth (GoTrue) 9999 http://your-host:9999/health
Storage 5000 http://your-host:5000/status
Studio 3000 http://your-host:3000/

Use Vigilmon monitors for each service. An outage in any one of them will degrade your app.

Setting Up a Public Status Page

Once your Supabase monitors are running in Vigilmon, enable a public status page. Your users can check status.yourapp.com during incidents instead of filing support tickets.

What to Watch Beyond Health Checks

Beyond uptime, watch for performance degradation:

  • If your Supabase queries take more than 2-3 seconds, set a timeout alert in Vigilmon
  • Monitor your edge functions — they can time out under load
  • Set an SSL certificate expiry alert for your custom domain

Start monitoring your Supabase app at vigilmon.online — free, 5-minute setup, multi-region checks.

Top comments (0)