# Health Check Specification ## Purpose A futó Next.js alkalmazás állapotát és build-/környezet-azonosító adatait szolgáltató `/api/health` végpont jelenlegi szerződését írja le. A végpont jelenleg nem végez MongoDB-kapcsolatellenőrzést. ## Requirements ### Requirement: Report application health metadata The health endpoint SHALL provide a non-cacheable JSON response to `GET /api/health` with HTTP 200 when the handler completes successfully. The response SHALL include `status: "ok"`, an ISO timestamp, process uptime, application version, deployment version (nullable), and runtime environment. #### Scenario: Read health metadata - **WHEN** a client sends `GET /api/health` and the handler completes successfully - **THEN** the endpoint SHALL return HTTP 200 with the application metadata and `Cache-Control: no-cache, no-store, must-revalidate` #### Scenario: Health handler fails - **WHEN** the handler encounters an unexpected error - **THEN** the endpoint SHALL return HTTP 503 with `status: "error"`, a timestamp, and a generic health failure message ### Requirement: Support lightweight HEAD health checks The health endpoint SHALL support `HEAD /api/health` without a response body and with HTTP 200 and a non-cacheable response header. #### Scenario: Probe health using HEAD - **WHEN** a client sends `HEAD /api/health` - **THEN** the endpoint SHALL return HTTP 200, no response body, and `Cache-Control: no-cache, no-store, must-revalidate` ## Open Questions - The current response is a direct status object, while `.agent/steering/architecture.md` and other documentation describe a shared `{ success, data, error }` response envelope. The contact endpoint also uses endpoint-specific response objects. Should these endpoint contracts or the shared convention be changed in a future change?