/** * Public `/api/status` resource route — mirrors the api+worker /status surface * so a single Statuspage / Uptime monitor can poll any one of the three apps. * * Returns the web service status plus a lightweight database readiness check. * High-frequency liveness probes should use `/healthz`; dependency-aware * readiness probes should use `/readyz`. This route is for status dashboards * that need one compact web-process + dependency signal. */ import { db } from "~/utils/db.server"; export async function loader(): Promise { let dbStatus: "ok" | "down" = "ok"; try { await db.appConfiguration.count(); } catch { dbStatus = "down"; } const overall = dbStatus === "ok" ? "ok" : "down"; return Response.json( { status: overall, service: "web", checks: { db: dbStatus }, version: process.env.APP_REVISION?.trim() || "unknown", uptime_seconds: Math.round(process.uptime()), region: process.env.APP_REGION?.trim() || process.env.FLY_REGION?.trim() || "unknown", }, { status: overall === "ok" ? 200 : 503 }, ); }