chore: refactor code structure for improved readability and maintenability#4
Conversation
There was a problem hiding this comment.
Pull request overview
This PR refactors the codebase to improve readability and maintainability (note: PR title has a typo - "maintenability" should be "maintainability"). The changes add infrastructure for production readiness including health checks, metrics monitoring, error handling, and improved build processes.
Key Changes:
- Added health check infrastructure with database and optional Redis monitoring using
@nestjs/terminus - Integrated Prometheus metrics collection via
@willsoto/nestjs-prometheus - Implemented global HTTP exception filter for standardized error responses
- Enhanced Docker configuration with OCI labels and health checks
- Added migration management scripts and lint-staged pre-commit hooks
Reviewed changes
Copilot reviewed 13 out of 14 changed files in this pull request and generated 12 comments.
Show a summary per file
| File | Description |
|---|---|
| package.json | Added new dependencies (terminus, prometheus, ioredis, rimraf, lint-staged), migration scripts, lint-staged configuration, and prebuild script |
| pnpm-lock.yaml | Updated lockfile with new dependencies and their transitive dependencies |
| libs/shared/src/http/http-exception.filter.ts | New global exception filter for standardizing error responses across the application |
| libs/shared/src/index.ts | Export new HTTP exception filter |
| libs/shared/src/config/index.ts | Added optional REDIS_URL environment variable to schema |
| libs/core/src/prometheus/prometheus.module.ts | New module configuring Prometheus metrics with default metrics enabled at /metrics endpoint |
| libs/core/src/index.ts | Export new Prometheus module |
| libs/core/src/core.module.ts | Import and register Prometheus module |
| apps/anchorpay/src/main.ts | Added global exception filter, enabled URI-based versioning, and imported versioning types |
| apps/anchorpay/src/health/redis-health.indicator.ts | New health indicator for Redis connectivity checks |
| apps/anchorpay/src/health/health.module.ts | Added TerminusModule and RedisHealthIndicator provider |
| apps/anchorpay/src/health/health.controller.ts | Refactored to use @nestjs/terminus for database and conditional Redis health checks |
| Dockerfile | Added OCI metadata labels and health check configuration |
| .husky/pre-commit | Added shebang and lint-staged execution |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 16 out of 17 changed files in this pull request and generated 7 comments.
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 16 out of 17 changed files in this pull request and generated 9 comments.
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@erickarugu I've opened a new pull request, #6, to work on those changes. Once the pull request is ready, I'll request review from you. |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…nd update health check messages
Description
Type of Change
Related Issue
Closes #
Changes Made
Testing
Test Instructions
Database Changes
API Changes
Security Considerations
Checklist
Screenshots/Videos
Additional Notes
Deployment Notes
.env.exampleReviewer Notes: