Skip to content

Add GET /health/ready DB-readiness endpoint #969

@pulzzejason

Description

@pulzzejason

Problem

There is no narrow database-readiness probe. The existing GET /api/health aggregates DB + Redis + JWKS checks, which is heavier than what a load balancer / orchestrator wants for a simple "is the DB reachable?" liveness/readiness poll.

Proposal

Add an App Router route handler at src/app/api/health/ready/route.ts that:

  • Exports an async GET handler (Next.js 15).
  • Uses the shared Prisma singleton (import { db } from "@/lib/db").
  • Pings the DB with await db.$queryRaw\SELECT 1``.
  • Returns 200 { status: "ok" } on success.
  • Returns 503 { status: "error", error: <message> } on failure — never throws / 500s.
  • Requires no auth/session (pollable by LBs and orchestrators).

Mirrors the checkDatabase() probe and 200/503 pattern already in src/app/api/health/route.ts.

Out of scope

  • Redis / JWKS checks (covered by /api/health).
  • Auth or rate limiting.

Engine task: 768f6c2c-f880-4cbe-8fbe-bac777b60925

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions