Skip to content

[backend] Health Check Endpoint (Supabase + Stellar) #5

Description

@josueazc

DESCRIPTION

There is no way to verify that the API's external dependencies (Supabase and Stellar testnet) are reachable and healthy. Without a health endpoint, Railway's deployment checks pass blindly and external monitoring tools cannot observe the system. This task adds GET /api/health returning structured connectivity status.

GOAL

GET /api/health returns a structured JSON status of Supabase and Stellar connectivity, with HTTP 200 when healthy or 503 when any dependency is down.

REQUIREMENTS

  • GET /api/health — no authentication required
  • Checks: Supabase reachability (simple DB ping), Stellar Horizon reachability
  • Response shape: { status: 'ok'|'degraded', supabase: 'up'|'down', stellar: 'up'|'down', uptime: seconds }
  • HTTP 200 when all up, HTTP 503 when any dependency is down
  • 3-second timeout per dependency check to avoid hanging

ACCEPTANCE CRITERIA

  • GET /api/health returns 200 with { status: 'ok', ... } in normal operation
  • Response includes supabase and stellar status fields
  • Response time is under 5s in normal operation
  • Endpoint is unauthenticated (no JWT required)
  • Work follows Velar monorepo structure
  • No existing endpoints are affected
  • Can be reviewed by the team

NOTES

Relevant files: apps/api/src/app.controller.ts or a new apps/api/src/health/ module. Good first task — no blockchain knowledge required. Consider @nestjs/terminus for structured health checks. Railway uses health checks to determine deployment success.


Difficulty: Beginner
Priority: Low

Metadata

Metadata

Assignees

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