feat: add GET /api/health with dependency checks #25

Merged
pook merged 1 commit from feature/api-health-endpoint into main 2026-04-09 06:13:06 -04:00
Owner

Summary

  • Add comprehensive GET /api/health endpoint that checks database connectivity (SELECT 1), OpenAI API reachability (models.list), and process memory usage
  • Returns structured JSON with status (healthy/degraded/down), uptime, timestamp, version, and per-check responseTime
  • Returns HTTP 200 for healthy, 503 for degraded/down
  • All dependency checks use timeouts (3s DB, 4s AI) to keep total response under 5s
  • Also available at existing /health path for backwards compatibility

Test plan

  • 8 unit tests with mocked DB and OpenAI dependencies
  • Tests cover: all healthy, DB down (503), AI down (503), missing API key, response structure, response times
  • TypeScript type-check passes (no new errors)

🤖 Generated with Claude Code

## Summary - Add comprehensive `GET /api/health` endpoint that checks database connectivity (SELECT 1), OpenAI API reachability (models.list), and process memory usage - Returns structured JSON with `status` (healthy/degraded/down), `uptime`, `timestamp`, `version`, and per-check `responseTime` - Returns HTTP 200 for healthy, 503 for degraded/down - All dependency checks use timeouts (3s DB, 4s AI) to keep total response under 5s - Also available at existing `/health` path for backwards compatibility ## Test plan - [x] 8 unit tests with mocked DB and OpenAI dependencies - [x] Tests cover: all healthy, DB down (503), AI down (503), missing API key, response structure, response times - [x] TypeScript type-check passes (no new errors) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Add GET /api/health that checks database connectivity, OpenAI reachability,
and memory usage. Returns structured JSON with per-check response times.
Returns 200 for healthy, 503 for degraded/down. All checks use timeouts
(3s DB, 4s AI) to keep total response under 5s.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
pook merged commit 12f9da96b1 into main 2026-04-09 06:13:06 -04:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
pook/compliancebot!25
No description provided.