{"id":17782168,"url":"https://github.com/bsnext/fastify-bowser","last_synced_at":"2026-03-09T23:04:25.890Z","repository":{"id":258525828,"uuid":"875159345","full_name":"bsnext/Fastify-Bowser","owner":"bsnext","description":"A plugin for Fastify that adds the 'request.useragent' property to get header 'user-agent' parsed data.","archived":false,"fork":false,"pushed_at":"2025-06-10T04:10:21.000Z","size":22,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-27T03:50:53.421Z","etag":null,"topics":["bowser","fastify","parser","plugin","typescript","useragent"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/@bsnext/fastify-bowser","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bsnext.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-10-19T08:49:10.000Z","updated_at":"2025-06-10T04:10:25.000Z","dependencies_parsed_at":null,"dependency_job_id":"0381bff5-6998-47c6-9348-8a6799cfd220","html_url":"https://github.com/bsnext/Fastify-Bowser","commit_stats":{"total_commits":3,"total_committers":1,"mean_commits":3.0,"dds":0.0,"last_synced_commit":"1f6e3d982da7ece9407f627e1f132c01f62a8d1c"},"previous_names":["bsnext/fastify-bowser"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/bsnext/Fastify-Bowser","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bsnext%2FFastify-Bowser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bsnext%2FFastify-Bowser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bsnext%2FFastify-Bowser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bsnext%2FFastify-Bowser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bsnext","download_url":"https://codeload.github.com/bsnext/Fastify-Bowser/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bsnext%2FFastify-Bowser/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267815187,"owners_count":24148356,"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-30T02:00:09.044Z","response_time":70,"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":["bowser","fastify","parser","plugin","typescript","useragent"],"created_at":"2024-10-27T05:04:05.222Z","updated_at":"2026-03-09T23:04:25.854Z","avatar_url":"https://github.com/bsnext.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Fastify-Bowser\n![Build \u0026 Test](https://github.com/bsnext/fastify-bowser/actions/workflows/build_n_test.yml/badge.svg)\n![Node.JS Supported](https://badgen.net/static/Node.JS/%3E=19.0.0/green)\n![Fastify Supported](https://badgen.net/static/Fastify/%3E=4.14.0/green)\n![Install Size](https://badgen.net/packagephobia/install/@bsnext/fastify-bowser)\n![Dependencies](https://badgen.net/bundlephobia/dependency-count/@bsnext/fastify-bowser)\n![License](https://badgen.net/static/license/MIT/blue)\n\nThe plugin adds the \"request.useragent\" property, which returns the parsed data.\n\n**Tested on Fastify v4.14+ and Node.JS v19+!**\u003cbr\u003e\nhttps://github.com/bsnext/fastify-bowser/actions/workflows/build_n_test.yml\n\nWhy \"[bowser](https://www.npmjs.com/package/bowser)\", not \"[ua-parser-js](https://www.npmjs.com/package/ua-parser-js)\" or other library?\nBowser it's a zero-dependency package with MIT license, unlike \"ua-parser-js\" under AGPL-3.0. Both of these libraries are good, but on top of that, bowser [is about x4 times more faster](https://github.com/bsnext/fastify-bowser/blob/master/info/benchmark.md).\n\nWhy not [those package](https://github.com/Eomm/fastify-user-agent)? Under hood it have a \"[useragent](https://www.npmjs.com/package/useragent)\" - library with 2 dependencies. One of that is \"LRU-Cache\". But without cache it [have a performance less than both previously](https://github.com/bsnext/fastify-bowser/blob/master/info/benchmark.md) mentioned libraries. Also, **this library excludes parsing of user-agent until you call this property in request**.\n\n## Installing:\n```bash\nnpm install @bsnext/fastify-bowser\n```\n\n## Usage:\n```ts\nimport FastifyBowser from '@bsnext/fastify-bowser'; // TS\nimport { default as FastifyBowser } from \"@bsnext/fastify-bowser\"; // MJS\nconst { default: FastifyBowser } = require(`@bsnext/fastify-bowser`); // CJS\n\nconst server = Fastify();\nawait server.register(FastifyBowser, {\n\t// Use parsed user-agent LRU cache\n\tcache: boolean = false; \n\n \t// Cache LRU max size.\n\tcacheLimit?: number = 100;\n\n\t// Automatically cache purge interval in seconds.\n\t// Disabled by default\n\tcachePurgeTime?: number;\n});\n\n```\n\n## Example\n\n```ts\nimport Fastify from 'fastify'; \nimport FastifyBowser from '@bsnext/fastify-bowser';\n\nconst server = Fastify(...);\nawait server.register(FastifyBowser, { cache: true });\n\nserver.get(`/test`, function(request, response) {\n\tresponse.send(request.useragent);\n\n\t/* {\n\t\tbrowser: { name: 'Chrome', version: '129.0.0.0' },\n\t\tos: { name: 'Windows', version: 'NT 10.0', versionName: '10' },\n\t\tplatform: { type: 'desktop' },\n\t\tengine: { name: 'Blink' }\n\t} */\n})\n\nserver.listen({ port: 8080 });\n\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbsnext%2Ffastify-bowser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbsnext%2Ffastify-bowser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbsnext%2Ffastify-bowser/lists"}