{"id":23176194,"url":"https://github.com/smartiniongithub/fastify-check-runtime-env","last_synced_at":"2026-05-18T00:07:07.725Z","repository":{"id":48410496,"uuid":"186694695","full_name":"smartiniOnGitHub/fastify-check-runtime-env","owner":"smartiniOnGitHub","description":"Fastify Plugin to check runtime environment properties","archived":false,"fork":false,"pushed_at":"2023-01-28T18:32:33.000Z","size":50,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-12T09:29:21.535Z","etag":null,"topics":["check","environment","fastify","fastify-plugin","runtime"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/smartiniOnGitHub.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-05-14T20:23:32.000Z","updated_at":"2022-03-26T10:46:53.000Z","dependencies_parsed_at":"2023-02-15T18:16:06.247Z","dependency_job_id":null,"html_url":"https://github.com/smartiniOnGitHub/fastify-check-runtime-env","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/smartiniOnGitHub/fastify-check-runtime-env","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smartiniOnGitHub%2Ffastify-check-runtime-env","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smartiniOnGitHub%2Ffastify-check-runtime-env/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smartiniOnGitHub%2Ffastify-check-runtime-env/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smartiniOnGitHub%2Ffastify-check-runtime-env/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/smartiniOnGitHub","download_url":"https://codeload.github.com/smartiniOnGitHub/fastify-check-runtime-env/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smartiniOnGitHub%2Ffastify-check-runtime-env/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267604404,"owners_count":24114531,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-28T02:00:09.689Z","response_time":68,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["check","environment","fastify","fastify-plugin","runtime"],"created_at":"2024-12-18T06:15:49.922Z","updated_at":"2026-05-18T00:07:02.703Z","avatar_url":"https://github.com/smartiniOnGitHub.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# fastify-check-runtime-env\n\n  [![NPM Version](https://img.shields.io/npm/v/fastify-check-runtime-env.svg?style=flat)](https://npmjs.org/package/fastify-check-runtime-env/)\n  [![NPM Downloads](https://img.shields.io/npm/dm/fastify-check-runtime-env.svg?style=flat)](https://npmjs.org/package/fastify-check-runtime-env/)\n  [![Code Style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](http://standardjs.com/)\n  [![license - APACHE-2.0](https://img.shields.io/npm/l/check-runtime-env.svg)](http://opensource.org/licenses/APACHE-2.0)\n\nFastify Plugin to check runtime environment properties\n\n\nThe purpose of this plugin is to let Fastify web applications do some checks \non some properties available at runtime (for example at application startup).\nBy default any checker method that doesn't satisfy its condition \nwill throw `Error`, but in some cases this is configurable via plugin options.\n\nNote that all Chechers features exposed here are in the the library [check-runtime-env](https://npmjs.org/package/check-runtime-env/).\nFor Semantic Versioning checks, see [semver](https://npmjs.org/package/semver/).\n\n\n## Usage\n\nA common use case is to throw an exception at application startup, \nif Node.js version is not compatible with the one set in `package.json`.\n\n```js\nconst fastify = require('fastify')()\nconst engines = require('../package.json').engines\n\n// register plugin with some options\nfastify.register(require('fastify-check-runtime-env'), {\n  // nodeStrictCheckAtStartup: true, // same as default\n  nodeVersionCheckAtStartup: true,\n  nodeVersionExpected: engines.node\n  // nodeVersionExpected: '\u003c=10.13.0 \u003e=200.0.0', // sample failing test\n  // onCheckMismatch: 'exception' // throw an exception // same as default\n})\n\nfastify.listen(3000)\n// curl http://127.0.0.1:3000/ =\u003e returning the home page, if current Node.js versio in compatible with the expected one\n```\n\nIn the [example](./example/) folder there are some simple server scripts \nthat uses the plugin (inline but it's the same using it from npm registry).\n\n\n## Requirements\n\nFastify ^4.0.1 , Node.js 14 LTS (14.15.0) or later.\nNote that plugin releases 3.x are for Fastify 3.x, 4.x are for Fastify 4.x, etc.\nOld plugin releases (0.x) are for Fastify 2.x but are now obsolete.\n\n\n## Sources\n\nSource code is all inside main repo:\n[fastify-check-runtime-env](https://github.com/smartiniOnGitHub/fastify-check-runtime-env).\n\nDocumentation generated from source code (library API):\n[here](https://smartiniongithub.github.io/fastify-check-runtime-env/).\n\n\n## Note\n\nThe plugin decorate Fastify and expose some functions:\n- `CheckRuntimeEnv`, the checkers implementation, as a class (RuntimeEnvChecker); \n  but note that to use it you need to wait for this plugin to be \n  fully loaded and initialized\n\nPlugin options are:\n- `onCheckMismatch`, define what to do if a checker fails (Node.js version \n  does not match with the expected one, JavaScript not in strict mode, etc); \n  by default 'exception' to raise an Error, \n  but could be 'warning' (to log a message in Fastify logs), \n  or 'exit' (to stop current Node.js process) with exit code 1\n- `nodeStrictCheckAtStartup`, flag to tell (when true) to check JavaScript \n  strict mode; by default true (safer and already enforced as default mode \n  in modern JavaScript code using classes, ES Modules, etc)\n- `nodeVersionCheckAtStartup`, flag to tell (when true) to check Node.js version \n  at application startup; by default false\n- 'nodeVersion' the current Node.js version (by default 'process.version')\n- `nodeVersionExpected`, the semver string with the expected Node.js version (by default empty, so must be manually provided, for example reading 'package.json' attribute 'engines.node' if specified)\n\nall plugin options are optional, and have a default value.\n\n\n## License\n\nLicensed under [Apache-2.0](./LICENSE).\n\n----\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmartiniongithub%2Ffastify-check-runtime-env","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsmartiniongithub%2Ffastify-check-runtime-env","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmartiniongithub%2Ffastify-check-runtime-env/lists"}