{"_id":"@bee4boop/nestjs-healthcheck","_rev":"5-c1368d37ec1191c77dc9032f0872ca74","name":"@bee4boop/nestjs-healthcheck","dist-tags":{"latest":"0.1.3"},"versions":{"0.1.2":{"name":"@bee4boop/nestjs-healthcheck","version":"0.1.2","keywords":["nestjs","health","healthcheck","uptime"],"license":"MIT","_id":"@bee4boop/nestjs-healthcheck@0.1.2","maintainers":[{"name":"bee4boop","email":"yachesberg@gmail.com"}],"homepage":"https://github.com/bee4boop/nestjs-healthcheck#readme","bugs":{"url":"https://github.com/bee4boop/nestjs-healthcheck/issues"},"dist":{"shasum":"ac0fc64ce942e7a4b578e1d2a52f7d54bd92025a","tarball":"https://registry.npmjs.org/@bee4boop/nestjs-healthcheck/-/nestjs-healthcheck-0.1.2.tgz","fileCount":17,"integrity":"sha512-8E2mZAuOMk3BGWcaj91SBxmtAf3T9hoj68UYOzGGgXNM94R3iQiOus5Ii2q9QeI5F7+Ug/y51/4dPlBYEsmrPQ==","signatures":[{"sig":"MEQCIG2rIZTOF4JocbDcIBASQm2nUBUGSEAayFsfqHqHHyJPAiAnG60nfc1MB4gcTyLa6gkN/ZzG2s30xc8soms0TC3wgg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":12465},"main":"dist/index.js","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","require":"./dist/index.js"}},"gitHead":"0460c42df4e5ecc678c9549c297d1d6b3740da4f","scripts":{"test":"jest --config jest.config.js","build":"tsc -p tsconfig.json","clean":"rm -rf dist","test:watch":"jest --watch --config jest.config.js","prepublishOnly":"npm run build"},"_npmUser":{"name":"bee4boop","email":"yachesberg@gmail.com"},"repository":{"url":"git+https://github.com/bee4boop/nestjs-healthcheck.git","type":"git"},"_npmVersion":"11.6.0","description":"Simple NestJS Health module that exposes GET /health with uptime and DB status.","directories":{},"_nodeVersion":"24.7.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","rxjs":"^7.8.1","ts-jest":"^29.2.5","supertest":"^7.0.0","typescript":"^5.6.3","@types/jest":"^29.5.12","@types/node":"^20.0.0","@nestjs/core":"^10.0.0","@nestjs/common":"^10.0.0","@nestjs/testing":"^10.0.0","@types/supertest":"^2.0.16","reflect-metadata":"^0.1.13","@nestjs/platform-express":"^10.0.0"},"peerDependencies":{"@nestjs/core":">=9 <12","@nestjs/common":">=9 <12"},"_npmOperationalInternal":{"tmp":"tmp/nestjs-healthcheck_0.1.2_1758035965167_0.699435829537254","host":"s3://npm-registry-packages-npm-production"}},"0.1.3":{"name":"@bee4boop/nestjs-healthcheck","version":"0.1.3","description":"Simple NestJS Health module that exposes GET /health with uptime and DB status.","license":"MIT","repository":{"type":"git","url":"git+https://github.com/bee4boop/nestjs-healthcheck.git"},"keywords":["nestjs","health","healthcheck","uptime"],"publishConfig":{"access":"public"},"main":"dist/index.js","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","require":"./dist/index.js"}},"scripts":{"build":"tsc -p tsconfig.json","clean":"rm -rf dist","prepublishOnly":"npm run build","test":"jest --config jest.config.js","test:watch":"jest --watch --config jest.config.js"},"peerDependencies":{"@nestjs/common":">=9 <12","@nestjs/core":">=9 <12"},"devDependencies":{"@nestjs/common":"^10.0.0","@nestjs/core":"^10.0.0","@nestjs/platform-express":"^10.0.0","@nestjs/testing":"^10.0.0","@types/jest":"^29.5.12","@types/supertest":"^2.0.16","@types/node":"^20.0.0","jest":"^29.7.0","reflect-metadata":"^0.1.13","rxjs":"^7.8.1","supertest":"^7.0.0","ts-jest":"^29.2.5","typescript":"^5.6.3"},"_id":"@bee4boop/nestjs-healthcheck@0.1.3","gitHead":"dc502c128a37374b59aca36494bcdb64eb423ba8","bugs":{"url":"https://github.com/bee4boop/nestjs-healthcheck/issues"},"homepage":"https://github.com/bee4boop/nestjs-healthcheck#readme","_nodeVersion":"22.18.0","_npmVersion":"10.9.3","dist":{"integrity":"sha512-ecavxWNrUFi39hBn5yl+qPAsaET/HFo2vqn75A30d9XNzL+q5soDuvTRVUoxhuJ8mKht80X1x88ahfOFgjPong==","shasum":"6655f744013cef8f172f8822dc0f64cfac46c923","tarball":"https://registry.npmjs.org/@bee4boop/nestjs-healthcheck/-/nestjs-healthcheck-0.1.3.tgz","fileCount":17,"unpackedSize":14161,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDPcSwc6UU/f5d2wkd8Yeo5P9fQIqIFyF/dpXD4oIb1WQIhAKVYvDOV9Ugt/mn3kxU0t5K+nYnzAndsMDdDz9k5vD1g"}]},"_npmUser":{"name":"bee4boop","email":"yachesberg@gmail.com"},"directories":{},"maintainers":[{"name":"bee4boop","email":"yachesberg@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/nestjs-healthcheck_0.1.3_1758064264328_0.8853699072504799"},"_hasShrinkwrap":false}},"time":{"created":"2025-09-16T15:19:25.067Z","modified":"2025-09-16T23:11:04.715Z","0.1.0":"2025-09-16T14:46:03.265Z","0.1.1":"2025-09-16T15:07:55.722Z","0.1.2":"2025-09-16T15:19:25.414Z","0.1.3":"2025-09-16T23:11:04.532Z"},"bugs":{"url":"https://github.com/bee4boop/nestjs-healthcheck/issues"},"license":"MIT","homepage":"https://github.com/bee4boop/nestjs-healthcheck#readme","keywords":["nestjs","health","healthcheck","uptime"],"repository":{"type":"git","url":"git+https://github.com/bee4boop/nestjs-healthcheck.git"},"description":"Simple NestJS Health module that exposes GET /health with uptime and DB status.","maintainers":[{"name":"bee4boop","email":"yachesberg@gmail.com"}],"readme":"## NestJS Healthcheck Lite\r\n\r\nSimple NestJS module that adds a `/health` GET route returning application uptime and database status.\r\n\r\n### Install\r\n\r\n```bash\r\nnpm install @bee4boop/nestjs-healthcheck\r\n# or\r\npnpm add @bee4boop/nestjs-healthcheck\r\n```\r\n\r\n### Usage\r\n\r\n```ts\r\nimport { Module } from '@nestjs/common'\r\nimport { HealthModule } from '@bee4boop/nestjs-healthcheck'\r\n\r\n@Module({\r\n\timports: [\r\n\t\t// Optional: pass a custom database checker\r\n\t\tHealthModule.forRoot({\r\n\t\t\tdatabaseCheck: async () => 'OK',\r\n\t\t}),\r\n\t],\r\n})\r\nexport class AppModule {}\r\n```\r\n\r\nThe `/health` endpoint returns JSON like:\r\n\r\n```json\r\n{\r\n\t\"uptime\": {\r\n\t\t\"system\": 278724,\r\n\t\t\"process\": 368,\r\n\t\t\"formatted\": {\r\n\t\t\t\"system\": \"3d 5h 25m\",\r\n\t\t\t\"process\": \"6m\"\r\n\t\t}\r\n\t},\r\n\t\"database\": \"OK\"\r\n}\r\n```\r\n\r\n### API\r\n\r\n- `HealthModule.forRoot(options?)`\r\n  - **databaseCheck**: optional `() => string | Promise<string>` returning database status. Default: `'OK'`. Throw to mark `'DOWN'`.\r\n\r\n### Examples: databaseCheck\r\n\r\n#### MongoDB (native driver)\r\n\r\n```ts\r\n// db/mongo.ts\r\nimport { MongoClient } from 'mongodb'\r\n\r\nexport const mongoClient = new MongoClient(process.env.MONGO_URI!)\r\n\r\nexport async function ensureMongoConnected() {\r\n\tif (!mongoClient.topology) {\r\n\t\tawait mongoClient.connect()\r\n\t}\r\n}\r\n```\r\n\r\n```ts\r\n// app.module.ts\r\nimport { Module } from '@nestjs/common'\r\nimport { HealthModule } from '@bee4boop/nestjs-healthcheck'\r\nimport { ensureMongoConnected, mongoClient } from './db/mongo'\r\n\r\n@Module({\r\n\timports: [\r\n\t\tHealthModule.forRoot({\r\n\t\t\tdatabaseCheck: async () => {\r\n\t\t\t\tawait ensureMongoConnected()\r\n\t\t\t\tawait mongoClient.db().command({ ping: 1 })\r\n\t\t\t\treturn 'OK'\r\n\t\t\t},\r\n\t\t}),\r\n\t],\r\n})\r\nexport class AppModule {}\r\n```\r\n\r\nNote: with Mongoose you can use `await mongoose.connection.db.admin().ping()`.\r\n\r\n#### PostgreSQL (pg)\r\n\r\n```ts\r\n// db/postgres.ts\r\nimport { Pool } from 'pg'\r\n\r\nexport const pgPool = new Pool({\r\n\tconnectionString: process.env.DATABASE_URL,\r\n})\r\n```\r\n\r\n```ts\r\n// app.module.ts\r\nimport { Module } from '@nestjs/common'\r\nimport { HealthModule } from '@bee4boop/nestjs-healthcheck'\r\nimport { pgPool } from './db/postgres'\r\n\r\n@Module({\r\n\timports: [\r\n\t\tHealthModule.forRoot({\r\n\t\t\tdatabaseCheck: async () => {\r\n\t\t\t\tawait pgPool.query('SELECT 1')\r\n\t\t\t\treturn 'OK'\r\n\t\t\t},\r\n\t\t}),\r\n\t],\r\n})\r\nexport class AppModule {}\r\n```\r\n\r\nAlternatives: TypeORM `await dataSource.query('SELECT 1')`, Prisma `await prisma.$queryRawUnsafe('SELECT 1')`.\r\n","readmeFilename":"README.md"}