{"_id":"@composius/payload-plugin-health","_rev":"4-dec708fb86ec4a60db60777a7d7428e5","name":"@composius/payload-plugin-health","dist-tags":{"latest":"1.2.0"},"versions":{"0.1.1":{"name":"@composius/payload-plugin-health","version":"0.1.1","author":{"name":"Composius"},"license":"MIT","_id":"@composius/payload-plugin-health@0.1.1","maintainers":[{"name":"vitrailweb","email":"vwnpm.garnet483@passmail.com"}],"dist":{"shasum":"14258b6e94f39749e2444f998ca3869612533ae8","tarball":"https://registry.npmjs.org/@composius/payload-plugin-health/-/payload-plugin-health-0.1.1.tgz","fileCount":5,"integrity":"sha512-TBmJ2gzquV8MH6ca3YSMBCKPfPWMux5dJL4NrTAKrNnQBUNPr9M0jwUkSly/MfqXLvS8QO63TKl51pzYTcTpCQ==","signatures":[{"sig":"MEYCIQDB3FFZoFWuOfVIiCZqCx3fvyXwj4vWiJI9AtD+h8AthwIhAMWico4W1yQwlNJ2UIHjJholM4S7bdITV1NBzXjf4wq1","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":11154},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=20.9.0","pnpm":"^9 || ^10 || ^11"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"}},"scripts":{"build":"tsup","clean":"rimraf {dist,*.tsbuildinfo}"},"_npmUser":{"name":"vitrailweb","email":"vwnpm.garnet483@passmail.com"},"repository":{"url":"https://github.com/Composius/payload-plugins","type":"git","directory":"packages/payload-plugin-health"},"description":"Health check endpoint with optional custom checks","directories":{},"_nodeVersion":"24.18.0","publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"8.5.0","rimraf":"3.0.2","payload":"3.84.1","typescript":"5.7.3"},"peerDependencies":{"payload":"^3.84.1"},"_npmOperationalInternal":{"tmp":"tmp/payload-plugin-health_0.1.1_1784453925297_0.5264724662215949","host":"s3://npm-registry-packages-npm-production"}},"1.0.0":{"name":"@composius/payload-plugin-health","version":"1.0.0","author":{"name":"Composius"},"license":"MIT","_id":"@composius/payload-plugin-health@1.0.0","maintainers":[{"name":"vitrailweb","email":"vwnpm.garnet483@passmail.com"}],"dist":{"shasum":"bc76380694f946f49329e5b00f61f28a2add06dc","tarball":"https://registry.npmjs.org/@composius/payload-plugin-health/-/payload-plugin-health-1.0.0.tgz","fileCount":5,"integrity":"sha512-HwcTCnXGiU6odxwx6fdaYD2ZVWZ4zafmaSsxTCzmpywAJI1SrAbS6SSBGqztzCW39qfsCFwCgI8mmKhlwo0CaA==","signatures":[{"sig":"MEUCIQDQdyqyi1sVKPyaWJbJ1MDs8BlW+Sj3UHBsdV7lJlNEmQIgJoPldbUmRG2NsD6ol/hw8Ijr6xJQNRRhgOFXfnOoGzA=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@composius%2fpayload-plugin-health@1.0.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":11154},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=20.9.0","pnpm":"^9 || ^10 || ^11"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"}},"scripts":{"build":"tsup","clean":"rimraf {dist,*.tsbuildinfo}"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:a7ab646b-770e-463e-9124-042b4351683c"}},"repository":{"url":"https://github.com/Composius/payload-plugins","type":"git","directory":"packages/payload-plugin-health"},"description":"Health check endpoint with optional custom checks","directories":{},"_nodeVersion":"22.23.1","publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"8.5.0","rimraf":"3.0.2","payload":"3.84.1","typescript":"5.7.3"},"peerDependencies":{"payload":"^3.84.1"},"_npmOperationalInternal":{"tmp":"tmp/payload-plugin-health_1.0.0_1785053186852_0.5390184389194057","host":"s3://npm-registry-packages-npm-production"}},"1.1.0":{"name":"@composius/payload-plugin-health","version":"1.1.0","author":{"name":"Composius"},"license":"MIT","_id":"@composius/payload-plugin-health@1.1.0","maintainers":[{"name":"vitrailweb","email":"vwnpm.garnet483@passmail.com"}],"dist":{"shasum":"219e186c483c8438f8efda4f5484029f94985129","tarball":"https://registry.npmjs.org/@composius/payload-plugin-health/-/payload-plugin-health-1.1.0.tgz","fileCount":5,"integrity":"sha512-R72knfJiznRX7W8jLGJMKvu6/ffh5ikSDrSO3YwiM+b/R7W48CuiNTNh1Kl1IsMWIkXezTn3GzSrdTGLcGerMQ==","signatures":[{"sig":"MEUCIQDGbWghASEdqFtzqsehoSTp4WIvualp/rWsw7scVq7hSwIgVaSsbmZbWnVJ8zsZCFcLuihNtpMsbeM0nbjVD/ZUOcM=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@composius%2fpayload-plugin-health@1.1.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":13243},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=20.9.0","pnpm":"^9 || ^10 || ^11"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"}},"scripts":{"build":"tsup","clean":"rimraf {dist,*.tsbuildinfo}"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:a7ab646b-770e-463e-9124-042b4351683c"}},"repository":{"url":"https://github.com/Composius/payload-plugins","type":"git","directory":"packages/payload-plugin-health"},"description":"Health check endpoint with optional custom checks","directories":{},"_nodeVersion":"22.23.1","publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"8.5.0","rimraf":"3.0.2","payload":"3.84.1","typescript":"5.7.3"},"peerDependencies":{"payload":"^3.84.1"},"_npmOperationalInternal":{"tmp":"tmp/payload-plugin-health_1.1.0_1785688213281_0.6945654191107342","host":"s3://npm-registry-packages-npm-production"}},"1.2.0":{"_id":"@composius/payload-plugin-health@1.2.0","dist":{"shasum":"910ddcde738a1765f7e2fc1780bf5245319ea1f4","tarball":"https://registry.npmjs.org/@composius/payload-plugin-health/-/payload-plugin-health-1.2.0.tgz","fileCount":5,"integrity":"sha512-MwsnGNVkbof3C31CE+LZyPteqz2LqagwswiG3gGK+FBnxuHdEPwDKt9uDVWYqj+AUjBZdauZKZjfCvcPcMQnzQ==","signatures":[{"sig":"MEYCIQCt9Yqp9bCutamlVKYVbsY3F06TbKY+MKij1Ixgp1WWbwIhAK1rlbRP9lW9mNbAetG7rGl55cw6Tfy2xFhnS7VpD9GH","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCICdpRaaed4eji8guYzqB0/Ro1XlSwgZx/b9znv5p7M2TAiBiK/laLTddz9iDAef4thA7v31aityB2jP2f/mcHEmhYw=="}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@composius%2fpayload-plugin-health@1.2.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":13394},"main":"./dist/index.js","name":"@composius/payload-plugin-health","type":"module","types":"./dist/index.d.ts","author":{"name":"Composius"},"engines":{"node":">=20.9.0","pnpm":"^9 || ^10 || ^11"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"}},"license":"MIT","scripts":{"build":"tsup","clean":"rimraf {dist,*.tsbuildinfo}"},"version":"1.2.0","_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:a7ab646b-770e-463e-9124-042b4351683c"}},"repository":{"url":"https://github.com/Composius/payload-plugins","type":"git","directory":"packages/payload-plugin-health"},"description":"Health check endpoint with optional custom checks","directories":{},"maintainers":[{"name":"vitrailweb","email":"vwnpm.garnet483@passmail.com"}],"_nodeVersion":"22.23.2","publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"8.5.0","rimraf":"3.0.2","payload":"3.90.1","typescript":"5.7.3"},"peerDependencies":{"payload":"^3.90.1"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/payload-plugin-health_1.2.0_1790020806264_0.06496415064164851"}}},"time":{"created":"2026-07-19T09:38:45.103Z","modified":"2026-09-21T20:00:06.665Z","0.1.1":"2026-07-19T09:38:45.454Z","1.0.0":"2026-07-26T08:06:27.003Z","1.1.0":"2026-08-02T16:30:13.419Z","1.2.0":"2026-09-21T20:00:06.372Z"},"author":{"name":"Composius"},"license":"MIT","repository":{"url":"https://github.com/Composius/payload-plugins","type":"git","directory":"packages/payload-plugin-health"},"description":"Health check endpoint with optional custom checks","maintainers":[{"name":"vitrailweb","email":"vwnpm.garnet483@passmail.com"}],"readme":"# @composius/payload-plugin-health\n\nA [Payload CMS](https://payloadcms.com) plugin that adds a health check\nendpoint (default: `GET /api/health`) for load balancers, uptime monitors, and\ncontainer orchestrators.\n\nWithout options it runs a built-in `database` check and reports\n`200 { status: 'ok' }` as soon as the Payload app is serving requests. Further\nnamed checks run on every request; if any of them throws, the endpoint responds\n`503` with per-check results.\n\n## Requirements\n\nThe following dependencies are required to be installed in your project before using this plugin:\n\n- `payload` (`^3.90.1`)\n\n```bash\npnpm add payload\n```\n\n## Usage\n\n```ts\nimport { buildConfig } from 'payload'\nimport { ComposiusPayloadPluginHealth } from '@composius/payload-plugin-health'\n\nexport default buildConfig({\n  plugins: [ComposiusPayloadPluginHealth()],\n  // ...\n})\n```\n\nThe built-in `database` check probes the database through the admin user\ncollection, which always exists, whatever its slug. Turn it off with\n`database: false`, or add your own checks alongside it:\n\n```ts\nComposiusPayloadPluginHealth({\n  checks: {\n    cache: async () => {\n      await redis.ping()\n    },\n  },\n})\n```\n\n```bash\ncurl -i http://localhost:3000/api/health\n```\n\nHealthy response (`200`):\n\n```json\n{\n  \"status\": \"ok\",\n  \"timestamp\": \"2026-07-18T12:00:00.000Z\",\n  \"checks\": { \"database\": { \"status\": \"ok\" } }\n}\n```\n\nFailing response (`503`):\n\n```json\n{\n  \"status\": \"error\",\n  \"timestamp\": \"2026-07-18T12:00:00.000Z\",\n  \"checks\": { \"database\": { \"status\": \"error\", \"error\": \"connection refused\" } }\n}\n```\n\nThe `checks` key is omitted when no checks are configured (i.e. with\n`database: false` and no `checks`).\n\n## Options\n\n| Option     | Type                          | Notes                                                                                                                                    |\n| ---------- | ----------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |\n| `path`     | `string`                      | endpoint path on the Payload API route, default `'/health'` (→ `/api/health` with the default Payload config)                             |\n| `database` | `boolean`                     | adds the built-in `database` check, default `true`; a `database` entry in `checks` takes precedence over it                               |\n| `checks`   | `Record<string, HealthCheck>` | named checks run on every request; each receives the `PayloadRequest`, a throw marks the response `error` (503) with the message reported |\n| `disabled` | `boolean`                     | leaves the config untouched                                                                                                               |\n\n## Notes\n\n- The endpoint is **unauthenticated** — anyone who can reach the API can call\n  it. Keep check errors free of secrets: the thrown message is included in the\n  response.\n- Responses are sent with `Cache-Control: no-store`.\n- Checks run in parallel; the response is `ok` only when every check resolves.\n","readmeFilename":""}