π Description
Add a /health endpoint for uptime monitoring and configure structured JSON logging so backend logs are parseable in production. Both are necessary before any deployment.
β
Requirements
- Install
@nestjs/terminus and create HealthModule
- Implement
GET /health that checks: HTTP server status, PostgreSQL connection, Stellar RPC reachability
- Each health indicator returns
{ status: 'up' | 'down', details?: object }
- Overall response is
200 when all healthy, 503 when any indicator is down
- Install
nestjs-pino or winston for structured JSON logging
- Replace default NestJS logger with structured logger
- Every log line includes:
timestamp, level, context (module name), message
- Log all incoming requests with method, path, statusCode, and response time
- Add
LOG_LEVEL env var (default: info)
π― Acceptance Criteria
π Expected files to change/structure
backend/src/health/health.module.ts
backend/src/health/health.controller.ts
backend/src/main.ts
backend/.env.example (add LOG_LEVEL)
Commit: chore: add health check endpoint and structured logging to backend
Branch: chore/backend-health-and-logging | Priority: LOW | Difficulty: one-coffee
π Description
Add a
/healthendpoint for uptime monitoring and configure structured JSON logging so backend logs are parseable in production. Both are necessary before any deployment.β Requirements
@nestjs/terminusand createHealthModuleGET /healththat checks: HTTP server status, PostgreSQL connection, Stellar RPC reachability{ status: 'up' | 'down', details?: object }200when all healthy,503when any indicator is downnestjs-pinoorwinstonfor structured JSON loggingtimestamp,level,context(module name),messageLOG_LEVELenv var (default:info)π― Acceptance Criteria
GET /healthreturns correct status for all three indicators503when database is unreachableLOG_LEVELenv var controls verbosityπ Expected files to change/structure
backend/src/health/health.module.tsbackend/src/health/health.controller.tsbackend/src/main.tsbackend/.env.example(add LOG_LEVEL)