Skip to content

Feat/api#517

Open
nafsonig wants to merge 9 commits intoPulsefy:mainfrom
nafsonig:feat/api
Open

Feat/api#517
nafsonig wants to merge 9 commits intoPulsefy:mainfrom
nafsonig:feat/api

Conversation

@nafsonig
Copy link
Copy Markdown

Summary

Describe what changed and why.

Summary
I've successfully expanded the /health endpoint for the LumenPulse backend with comprehensive monitoring of database, Redis, and Stellar Horizon availability, including graceful degradation support.

✅ What's Been Implemented
Three Health Endpoints:

GET /health - Main endpoint (200 OK if database up, 503 if down, includes all service statuses)
GET /health/detailed - Detailed status (always 200 OK, informational)
GET /health/ready - Readiness probe (Kubernetes-compatible)
Service Monitoring:

Database (PostgreSQL) - CRITICAL service via TCP connection check
Redis - NON-CRITICAL service via cache set/get/delete test
Stellar Horizon - NON-CRITICAL service via HTTP API call
Graceful Degradation Implementation:

API returns HTTP 200 (stays up) even if Redis or Horizon fail
API returns HTTP 503 only if database fails
All service statuses included in response for visibility
Non-critical service failures logged but don't block requests
📁 Files Created
Source Code:

src/health/health.module.ts - Module definition
src/health/health.controller.ts - Three REST endpoints
src/health/health.service.ts - Health check logic
src/health/health.controller.spec.ts - Unit tests
Documentation (3 comprehensive guides):

src/health/README.md - Module overview
src/health/QUICK_REFERENCE.md - Quick start guide
src/health/HEALTH_CHECK_IMPLEMENTATION.md - Detailed technical docs
HEALTH_CHECK_EXPANSION.md - Implementation details
HEALTH_CHECK_COMPLETION.md - This summary
Configuration:

Modified src/app.module.ts to integrate HealthModule
🎯 Acceptance Criteria Met
/health returns status of DB, Redis, and Horizon
Graceful degradation: API stays "up" even if some non-critical services are down

Linked Issue

Closes #503

Type of Change

  • feat
  • fix
  • docs
  • refactor
  • test
  • chore

Validation

  • Lint passed for affected area(s)
  • Tests passed for affected area(s)
  • Manual verification completed (if applicable)

Documentation

  • Documentation updated (or N/A with explanation)
  • [] Screenshots/videos attached for UI changes

Checklist

  • Branch name uses feat/, fix/, or docs/
  • Commit messages follow Conventional Commits
  • PR scope matches linked issue acceptance criteria

@drips-wave
Copy link
Copy Markdown

drips-wave bot commented Mar 30, 2026

@nafsonig Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Cedarich
Copy link
Copy Markdown
Contributor

@nafsonig please fix Run npm run lint

[email protected] lint
eslint "{src,apps,libs,test}/**/*.ts" --fix

/home/runner/work/Lumenpulse/Lumenpulse/apps/backend/src/health/health.controller.spec.ts
Error: 30:9 error Unsafe return of a value of type any @typescript-eslint/no-unsafe-return
Error: 187:9 error Unsafe return of a value of type any @typescript-eslint/no-unsafe-return

/home/runner/work/Lumenpulse/Lumenpulse/apps/backend/src/health/health.controller.ts
Error: 150:13 error Unsafe assignment of an any value @typescript-eslint/no-unsafe-assignment
Error: 152:32 error Unsafe member access .status on an any value @typescript-eslint/no-unsafe-member-access
Error: 153:9 error Unsafe assignment of an any value @typescript-eslint/no-unsafe-assignment
Error: 153:33 error Unsafe member access .message on an any value @typescript-eslint/no-unsafe-member-access

/home/runner/work/Lumenpulse/Lumenpulse/apps/backend/src/health/health.service.ts
Error: 159:14 error 'error' is defined but never used @typescript-eslint/no-unused-vars
Error: 179:14 error 'error' is defined but never used @typescript-eslint/no-unused-vars
Error: 201:13 error Unsafe assignment of an any value @typescript-eslint/no-unsafe-assignment
Error: 201:19 error A require() style import is forbidden @typescript-eslint/no-require-imports
Error: 202:13 error Unsafe assignment of an any value @typescript-eslint/no-unsafe-assignment
Error: 202:22 error Unsafe construction of an any typed value @typescript-eslint/no-unsafe-call
Error: 202:30 error Unsafe member access .Socket on an any value @typescript-eslint/no-unsafe-member-access
Error: 205:7 error Unsafe call of an any typed value @typescript-eslint/no-unsafe-call
Error: 205:14 error Unsafe member access .setTimeout on an any value @typescript-eslint/no-unsafe-member-access
Error: 207:7 error Unsafe call of an any typed value @typescript-eslint/no-unsafe-call
Error: 207:14 error Unsafe member access .on on an any value @typescript-eslint/no-unsafe-member-access
Error: 208:9 error Unsafe call of an any typed value @typescript-eslint/no-unsafe-call
Error: 208:16 error Unsafe member access .destroy on an any value @typescript-eslint/no-unsafe-member-access
Error: 212:7 error Unsafe call of an any typed value @typescript-eslint/no-unsafe-call
Error: 212:14 error Unsafe member access .on on an any value @typescript-eslint/no-unsafe-member-access
Error: 213:9 error Unsafe call of an any typed value @typescript-eslint/no-unsafe-call
Error: 213:16 error Unsafe member access .destroy on an any value @typescript-eslint/no-unsafe-member-access
Error: 217:7 error Unsafe call of an any typed value @typescript-eslint/no-unsafe-call
Error: 217:14 error Unsafe member access .on on an any value @typescript-eslint/no-unsafe-member-access
Error: 221:7 error Unsafe call of an any typed value @typescript-eslint/no-unsafe-call
Error: 221:14 error Unsafe member access .connect on an any value @typescript-eslint/no-unsafe-member-access

✖ 27 problems (27 errors, 0 warnings)

Error: Process completed with exit code 1.

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.

API Health Monitoring: Advanced Health Checks

2 participants