Skip to content

feat: add /api/health endpoint and backend compose healthcheck - #126

Open
dogancanbakir wants to merge 1 commit into
mainfrom
claude/issue-40-health
Open

dogancanbakir wants to merge 1 commit into
mainfrom
claude/issue-40-health

Conversation

@dogancanbakir

@dogancanbakir dogancanbakir commented Nov 1, 2026 •

Copy link
Copy Markdown
Member

Summary

Closes #40 — /api/health was whitelisted as a public endpoint by the tenant interceptor (tenant-query.interceptor.ts:38) but never implemented, and the backend service had no healthcheck in docker-compose.yml.

Changes

  • GET /api/health on the root controller: { status, timestamp, uptime, checks: { database } }, where the database check runs a live SELECT 1 through the TypeORM DataSource. Returns 503 (ServiceUnavailableException with the same payload) when the DB is unreachable, so orchestrators see real liveness.
  • docker-compose.yml: backend service healthcheck (wget -qO- http://localhost:3000/api/health, 30s interval, 30s start period).
  • Unit tests: healthy path and DB-down path (mocked DataSource).

Pairs with the Dockerfile healthcheck fix in HappyHackingSpace/CommunityHub#124 — once this lands, the Dockerfile check can also target the HTTP endpoint instead of pgrep.

Testing

npm run build clean; npx jest src/app.controller.spec.ts 3/3 green.

The tenant interceptor already whitelists /api/health as public, but no
controller implemented it, and the backend service had no compose
healthcheck. GET /api/health now reports status/uptime and a live
database check (503 when the DB is unreachable); docker-compose gains a
wget-based healthcheck against it.

Closes #40
@coderabbitai

coderabbitai Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 59 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 3ed98e5d-8ceb-4362-a334-970054d11c95
Commits

Reviewing files that changed from the base of the PR and between 04fcd32 and ba11db5.

Files selected for processing: 3
  • backend/src/app.controller.spec.ts
  • backend/src/app.controller.ts
  • docker-compose.yml
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@dogancanbakir
dogancanbakir force-pushed the claude/issue-40-health branch from c62c703 to ba11db5 Compare November 2, 2026 05:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: Add /api/health endpoint and backend healthcheck

1 participant