{"id":20782449,"url":"https://github.com/smartiniongithub/fastify-nats-client","last_synced_at":"2025-10-09T16:22:26.975Z","repository":{"id":33728534,"uuid":"159241220","full_name":"smartiniOnGitHub/fastify-nats-client","owner":"smartiniOnGitHub","description":"Fastify Plugin for Client connections to NATS Server","archived":false,"fork":false,"pushed_at":"2024-09-28T14:25:53.000Z","size":55,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-09T16:22:26.404Z","etag":null,"topics":["fastify","fastify-plugin","messaging","nats","nats-client","nats-messaging","queue"],"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":"2018-11-26T22:26:32.000Z","updated_at":"2024-09-28T14:20:54.000Z","dependencies_parsed_at":"2023-02-15T18:16:06.067Z","dependency_job_id":"4773cd81-6757-4d16-a4b2-c6a7292f5bcd","html_url":"https://github.com/smartiniOnGitHub/fastify-nats-client","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"purl":"pkg:github/smartiniOnGitHub/fastify-nats-client","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smartiniOnGitHub%2Ffastify-nats-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smartiniOnGitHub%2Ffastify-nats-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smartiniOnGitHub%2Ffastify-nats-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smartiniOnGitHub%2Ffastify-nats-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/smartiniOnGitHub","download_url":"https://codeload.github.com/smartiniOnGitHub/fastify-nats-client/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smartiniOnGitHub%2Ffastify-nats-client/sbom","scorecard":{"id":832816,"data":{"date":"2025-08-11","repo":{"name":"github.com/smartiniOnGitHub/fastify-nats-client","commit":"132148ccaaac8a2155f598c65b15cb6f93df8a1c"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: Apache License 2.0: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 2 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-23T18:11:02.458Z","repository_id":33728534,"created_at":"2025-08-23T18:11:02.458Z","updated_at":"2025-08-23T18:11:02.458Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279001767,"owners_count":26083171,"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-10-09T02:00:07.460Z","response_time":59,"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":["fastify","fastify-plugin","messaging","nats","nats-client","nats-messaging","queue"],"created_at":"2024-11-17T14:11:13.045Z","updated_at":"2025-10-09T16:22:26.928Z","avatar_url":"https://github.com/smartiniOnGitHub.png","language":"JavaScript","readme":"# fastify-nats-client\n\n  [![NPM Version](https://img.shields.io/npm/v/fastify-nats-client.svg?style=flat)](https://npmjs.org/package/fastify-nats-client/)\n  [![NPM Downloads](https://img.shields.io/npm/dm/fastify-nats-client.svg?style=flat)](https://npmjs.org/package/fastify-nats-client/)\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/fastify-nats-client.svg)](http://opensource.org/licenses/APACHE-2.0)\n\nFastify Plugin to use [NATS](http://nats.io) Server to exchange messages via queues etc.\n\nUnder the hood [nats.js](https://github.com/nats-io/nats.js) library is used; \nthe plugin has some options (to set in the `register`), \nsome will be sent to the nats library for connection details etc.\n\n\n## Usage\nAdd it to you project with `register` and you are done!  \nYou can access the *nats Connection* via `fastify.nc`.\nNote that even the *NATS library* is exposed at `fastify.NATS` but only \nas a convenience (to avoid refer to it directly as a Node.js library).\n```js\nconst fastify = require('fastify')\n\n// register the plugin with some options, for example:\nfastify.register(require('fastify-nats-client'), {\n  natsOptions: { servers: 'nats://demo.nats.io:4222' }\n})\n\nfastify.listen({ port: 3000, host: 'localhost' }, (err, address) =\u003e {\n  if (err) throw err\n  console.log(`server listening on ${address}`)\n})\n```\n\nand later\n```js\n// get some NATS-related facilities\nconst nc = fastify.nc // get the NATS Connection with servers\nconst sc = fastify.NATS.StringCodec() // codec for a string message\nconst jc = fastify.NATS.JSONCodec() // codec for a JSON string message\n// const subject = fastify.NATS.createInbox() // sample queue name\n// publish/subscribe, example\nnc.publish(queueName, sc.encode(msg)) // simple publisher for a string message\nnc.publish(queueName, jc.encode(obj)) // simple publisher for a JSON message\nnc.subscribe( ... ) // use an async iterator or a callback\n// etc ...\n```\n\nIn the [example](./example/) folder there is a simple server scripts that\nuses the plugin (inline but it's the same using it from npm registry).\n\nAs you can see, the NATS.js library is complex and with a lot of features, \nplease refer to its documentation and sources for more info and examples.\n\n\n## Requirements\n\nFastify ^5.0.0 , Node.js 20 LTS (20.9.0) or later.\nNote that plugin releases 4.x are for Fastify 4.x, 5.x for Fastify 5.x, etc.\n\n\n## Sources\n\nSource code is all inside main repo:\n[fastify-nats-client](https://github.com/smartiniOnGitHub/fastify-nats-client).\n\nDocumentation generated from source code (library API):\n[here](https://smartiniongithub.github.io/fastify-nats-client/).\n\n\n## Note\n\nAll the code here is based on the work done initially by its original author \n(mahmed8003 \u003cmahmed8003@gmail.com\u003e), in the upstream repository \n[fastify-nats](https://github.com/mahmed8003/fastify-nats), under the MIT license.\n\nThe plugin decorate Fastify and expose some functions:\n- `NATS`, a reference to the NATS library, but only as a convenience\n- `nc`, the NATS Connection to use; \n  even if a little criptic, I used those names to better align with NATS.js sources and examples\n\nSome plugin options are sent directly to \n[NATS.js - NATS-io - GitHub](https://github.com/nats-io/node-nats) library, like:\n- `natsOptions`, general connetion options for the NATS Server, \n  see [Changed configuration properties - NATS.js](https://github.com/nats-io/nats.js/blob/main/migration.md#changed-configuration-properties)\nwhile others are only used inside the plugin, to configure its behavior, like:\n- `drainOnClose`, flag (by default false) to enable the drain of \n  last data from the NATS connection when the plugin has to close \n- `enableDefaultNATSServer`, flag (by default false) to enable connections \n  to public NATS Demo Server (so if a NATS server is not specified \n  and this flag is disabled an Error will be raised), \n  useful for a fast start on tests and examples;\n  default setting is to avoid connections to that (external and public) server, \n  for example by plugin configuration mistake\n\nall plugin options are optional and have a default value set in the plugin.\n\nDefault NATS Server in the plugin is set to the public demo NATS Server \n`nats://demo.nats.io:4222`, to be able to do a quick start; \nanyway note that in some cases it could not be reachable \n(for example by corporate firewall rules), so even plugin tests could fail \nin that case.\nTo perform some local tests, it's possible to use a NATS Server Docker image from \nstandard image [NATS - DockerHub](https://hub.docker.com/_/nats/); \nfor convenience, they are defined in `package.json` like `docker:nats:start` \nand the same for `log|process|stop` etc.\n\nCurrent version of the plugin uses the usual [nats](https://www.npmjs.com/package/nats) library,\nwhich has been moved as sources to [nats.node - GitHub](https://github.com/nats-io/nats.node); \n**future versions of the plugin** will be updated to use newer major release of the library \n(that has been splitted in multiple libraries to be more modular, \nwith core features in '@nats-io/nats-core'); \nsee [Migration guide - nats.js - GitHub](https://github.com/nats-io/nats.js/blob/main/migration.md) \nfor more info.\n\n\n## License\n\nLicensed under [Apache-2.0](./LICENSE).\n\n----\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmartiniongithub%2Ffastify-nats-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsmartiniongithub%2Ffastify-nats-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmartiniongithub%2Ffastify-nats-client/lists"}