{"_id":"@standardserver/fastify","_rev":"8-25d3e71a7338a77f68a48e580b49004b","name":"@standardserver/fastify","dist-tags":{"latest":"0.8.3"},"versions":{"0.6.0":{"name":"@standardserver/fastify","version":"0.6.0","license":"MIT","_id":"@standardserver/fastify@0.6.0","maintainers":[{"name":"dinwwwh","email":"dinwwwh@gmail.com"}],"homepage":"https://standardserver.dev","dist":{"shasum":"25457ddca52c668d2ff6fe689929e3d93047141c","tarball":"https://registry.npmjs.org/@standardserver/fastify/-/fastify-0.6.0.tgz","fileCount":6,"integrity":"sha512-3/Ul0TGqPHQYTkVkztnvxhBpxuFQmPNVKh1vNNofLq648yyZROqlNsZ2IsjDTctwZ66thgj5m80kn4vloae+dQ==","signatures":[{"sig":"MEUCIQCHidMTqKulvr+Ea2Tf1/RJA4dOJcxC1+pyizMAgnbongIgW1xf2yQIc/AuMF5DbE0cgug9LLytdmEAW0gd6BfuXdQ=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":33060},"type":"module","exports":{".":{"types":"./dist/index.d.mts","import":"./dist/index.mjs","default":"./dist/index.mjs"},"./package.json":"./package.json"},"scripts":{"build":"unbuild","type:check":"tsc -b"},"_npmUser":{"name":"dinwwwh","email":"dinwwwh@gmail.com"},"repository":{"url":"git+https://github.com/middleapi/standardserver.git","type":"git","directory":"packages/fastify"},"directories":{},"sideEffects":false,"_nodeVersion":"26.0.0","dependencies":{"@standardserver/core":"0.6.0","@standardserver/node":"0.6.0"},"_hasShrinkwrap":false,"devDependencies":{"fastify":"^5.11.0","supertest":"^7.1.4","@types/node":"^26.0.0","@fastify/cookie":"^11.1.2","@types/supertest":"^6.0.3"},"peerDependencies":{"fastify":">=5.6.1"},"_npmOperationalInternal":{"tmp":"tmp/fastify_0.6.0_1785590081196_0.5447355890361554","host":"s3://npm-registry-packages-npm-production"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"0.7.0":{"name":"@standardserver/fastify","version":"0.7.0","license":"MIT","_id":"@standardserver/fastify@0.7.0","maintainers":[{"name":"dinwwwh","email":"dinwwwh@gmail.com"}],"homepage":"https://standardserver.dev","dist":{"shasum":"5da55d16df327de150986db1c7ee77fe042d0e5c","tarball":"https://registry.npmjs.org/@standardserver/fastify/-/fastify-0.7.0.tgz","fileCount":6,"integrity":"sha512-UKcSScU5RuiufqGU0sVDFUXY5TqNAG3oXyG8QJCeMXCfpWos6d/VCgmfB27QrdWQtmuoE4DvSCeAaFG4+mZCnw==","signatures":[{"sig":"MEUCIFcDRmy/EXrPgbzhdYBl7vQaYlc0HznMUPz4WwHpWkaEAiEAk9dgW0SiUTly5gSTQFuLA/pl6z5czQaUHOoON3oh7A4=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@standardserver%2ffastify@0.7.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":33559},"type":"module","exports":{".":{"types":"./dist/index.d.mts","import":"./dist/index.mjs","default":"./dist/index.mjs"},"./package.json":"./package.json"},"scripts":{"build":"unbuild","type:check":"tsc -b"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:99990171-5e83-42aa-9fa6-87ced349a000"}},"repository":{"url":"git+https://github.com/middleapi/standardserver.git","type":"git","directory":"packages/fastify"},"directories":{},"sideEffects":false,"_nodeVersion":"22.23.1","dependencies":{"@standardserver/core":"0.7.0","@standardserver/node":"0.7.0"},"_hasShrinkwrap":false,"devDependencies":{"fastify":"^5.11.0","supertest":"^7.1.4","@types/node":"^26.1.2","@fastify/cookie":"^11.1.2","@types/supertest":"^7.2.1"},"peerDependencies":{"fastify":">=5.6.1"},"_npmOperationalInternal":{"tmp":"tmp/fastify_0.7.0_1785726793490_0.6829087001811549","host":"s3://npm-registry-packages-npm-production"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"0.7.1":{"name":"@standardserver/fastify","version":"0.7.1","license":"MIT","_id":"@standardserver/fastify@0.7.1","maintainers":[{"name":"dinwwwh","email":"dinwwwh@gmail.com"}],"homepage":"https://standardserver.dev","dist":{"shasum":"81ae8b7eaf2bccac1d43845f345df8ff129ffb7f","tarball":"https://registry.npmjs.org/@standardserver/fastify/-/fastify-0.7.1.tgz","fileCount":6,"integrity":"sha512-Oa+ttR0CyNkFjNczs2dO/WFFeZ4sAszVBKIOhKb1FFcDtD9VdqDgMBhbQ4sFR885fwpYckoYjFU6xXWWTueBlw==","signatures":[{"sig":"MEYCIQDyuZX3gDZ6DFI0c1NB5rNiEyYSbDtaVJE/yhtJ+yitVwIhAPHMezvHlBTRUF7rES1Wi/Zj4AYuf89Pggb5yaL5PefZ","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@standardserver%2ffastify@0.7.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":33638},"type":"module","exports":{".":{"types":"./dist/index.d.mts","import":"./dist/index.mjs","default":"./dist/index.mjs"},"./package.json":"./package.json"},"scripts":{"build":"unbuild","type:check":"tsc -b"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:99990171-5e83-42aa-9fa6-87ced349a000"}},"repository":{"url":"git+https://github.com/middleapi/standardserver.git","type":"git","directory":"packages/fastify"},"directories":{},"sideEffects":false,"_nodeVersion":"22.23.1","dependencies":{"@standardserver/core":"0.7.1","@standardserver/node":"0.7.1"},"_hasShrinkwrap":false,"devDependencies":{"fastify":"^5.11.0","supertest":"^7.1.4","@types/node":"^26.1.2","@fastify/cookie":"^11.1.2","@types/supertest":"^7.2.1"},"peerDependencies":{"fastify":">=5.6.1"},"peerDependenciesMeta":{"fastify":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/fastify_0.7.1_1785734629786_0.9508675405394358","host":"s3://npm-registry-packages-npm-production"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"0.8.0":{"name":"@standardserver/fastify","version":"0.8.0","license":"MIT","_id":"@standardserver/fastify@0.8.0","maintainers":[{"name":"dinwwwh","email":"dinwwwh@gmail.com"}],"homepage":"https://standardserver.dev","dist":{"shasum":"8deb58d606d694f710d13634f91238bdf53f521f","tarball":"https://registry.npmjs.org/@standardserver/fastify/-/fastify-0.8.0.tgz","fileCount":6,"integrity":"sha512-nEnFDgb0UwY5PX+PEfP3hG3IKJQvk889Hief6EW3EtjWOPwMW5clBGhW59UJKqP4Z9kTTV040hmpFLZwfVlo4A==","signatures":[{"sig":"MEUCIArHf9tP7gpwIezPwXDnygnpE5DicVDvMi9E5ltWztF4AiEAlgtfsroEegJ+xhfvIhTYvBdEaRpeL6z9hr/euTZFnaI=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@standardserver%2ffastify@0.8.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":27093},"type":"module","exports":{".":{"types":"./dist/index.d.mts","import":"./dist/index.mjs","default":"./dist/index.mjs"},"./package.json":"./package.json"},"scripts":{"build":"unbuild","type:check":"tsc -b"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:99990171-5e83-42aa-9fa6-87ced349a000"}},"repository":{"url":"git+https://github.com/middleapi/standardserver.git","type":"git","directory":"packages/fastify"},"directories":{},"sideEffects":false,"_nodeVersion":"22.23.2","dependencies":{"@standardserver/core":"0.8.0","@standardserver/node":"0.8.0"},"_hasShrinkwrap":false,"devDependencies":{"fastify":"^5.11.0","supertest":"^7.1.4","@types/node":"^26.1.2","@fastify/cookie":"^11.1.2","@types/supertest":"^7.2.1"},"peerDependencies":{"fastify":">=5.6.1"},"peerDependenciesMeta":{"fastify":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/fastify_0.8.0_1786693982038_0.3383980368787589","host":"s3://npm-registry-packages-npm-production"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"0.8.1":{"name":"@standardserver/fastify","version":"0.8.1","keywords":["standardserver","fastify","adapter","http","server","request","response","streaming","sse","typescript"],"license":"MIT","_id":"@standardserver/fastify@0.8.1","maintainers":[{"name":"dinwwwh","email":"dinwwwh@gmail.com"}],"homepage":"https://standardserver.dev","dist":{"shasum":"096cb3b7a855f240abc904a05932dd9c1103ac1b","tarball":"https://registry.npmjs.org/@standardserver/fastify/-/fastify-0.8.1.tgz","fileCount":6,"integrity":"sha512-yMoW0SrevK1+SGjwpRgxanDByERKS1G/MfQtPczcB7oGX/Z1I7L6HmL+k1sGba2c2QqkLC4S+GNQ7gqZ5UZ3kw==","signatures":[{"sig":"MEUCIQDKs+a+cM1n/xF1bLXQT6AguyU+zMUyfYQqywkl8vgBGQIgDkhzYdHJgbZdKrcIAB2M3Ld176tFeCD0uuzWZc2e38Q=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@standardserver%2ffastify@0.8.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":29877},"type":"module","exports":{".":{"types":"./dist/index.d.mts","import":"./dist/index.mjs","default":"./dist/index.mjs"},"./package.json":"./package.json"},"funding":["https://github.com/sponsors/dinwwwh","https://opencollective.com/middleapi"],"scripts":{"build":"unbuild","type:check":"tsc -b"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:99990171-5e83-42aa-9fa6-87ced349a000"}},"repository":{"url":"git+https://github.com/middleapi/standardserver.git","type":"git","directory":"packages/fastify"},"description":"Fastify adapter for Standard Server: transport-agnostic requests, responses, and streaming on top of Fastify's request and reply objects","directories":{},"sideEffects":false,"_nodeVersion":"22.23.2","dependencies":{"@standardserver/core":"0.8.1","@standardserver/node":"0.8.1"},"_hasShrinkwrap":false,"devDependencies":{"fastify":"^5.11.0","supertest":"^7.1.4","@types/node":"^26.1.2","@fastify/cookie":"^11.1.2","@types/supertest":"^7.2.1"},"peerDependencies":{"fastify":">=5.6.1"},"peerDependenciesMeta":{"fastify":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/fastify_0.8.1_1787717035601_0.4267308193479711","host":"s3://npm-registry-packages-npm-production"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"0.8.2":{"name":"@standardserver/fastify","version":"0.8.2","keywords":["standardserver","fastify","adapter","http","server","request","response","streaming","sse","typescript"],"license":"MIT","_id":"@standardserver/fastify@0.8.2","maintainers":[{"name":"dinwwwh","email":"dinwwwh@gmail.com"}],"homepage":"https://standardserver.dev","dist":{"shasum":"236d8d8abac2898f29c53d342a4c0de7cd9d47f4","tarball":"https://registry.npmjs.org/@standardserver/fastify/-/fastify-0.8.2.tgz","fileCount":6,"integrity":"sha512-jio9nXhdD0k4aC6k9/9n5BL2UvrhLINWmO8Na/ZuhtbDTRkfES4h+rKP2w5CFtbfFw//TcWZNC2m01GMOFRsGQ==","signatures":[{"sig":"MEYCIQCMv6ji9WwKhLHXEOwa6sEvt+0MlFoYwpwx4ESmDTWZCQIhAMKxkVn026ZzGjL8lk4zqFy2sigGe428/AZhqOKUuAr6","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@standardserver%2ffastify@0.8.2","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":29877},"type":"module","exports":{".":{"types":"./dist/index.d.mts","import":"./dist/index.mjs","default":"./dist/index.mjs"},"./package.json":"./package.json"},"funding":["https://github.com/sponsors/dinwwwh","https://opencollective.com/middleapi"],"scripts":{"build":"unbuild","type:check":"tsc -b"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:99990171-5e83-42aa-9fa6-87ced349a000"}},"repository":{"url":"git+https://github.com/middleapi/standardserver.git","type":"git","directory":"packages/fastify"},"description":"Fastify adapter for Standard Server: transport-agnostic requests, responses, and streaming on top of Fastify's request and reply objects","directories":{},"sideEffects":false,"_nodeVersion":"22.23.2","dependencies":{"@standardserver/core":"0.8.2","@standardserver/node":"0.8.2"},"_hasShrinkwrap":false,"devDependencies":{"fastify":"^5.11.0","supertest":"^7.1.4","@types/node":"^26.1.2","@fastify/cookie":"^11.1.2","@types/supertest":"^7.2.1"},"peerDependencies":{"fastify":">=5.6.1"},"peerDependenciesMeta":{"fastify":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/fastify_0.8.2_1787794796535_0.8559799747061116","host":"s3://npm-registry-packages-npm-production"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"0.8.3":{"name":"@standardserver/fastify","version":"0.8.3","keywords":["standardserver","fastify","adapter","http","server","request","response","streaming","sse","typescript"],"license":"MIT","_id":"@standardserver/fastify@0.8.3","maintainers":[{"name":"dinwwwh","email":"dinwwwh@gmail.com"}],"homepage":"https://standardserver.dev","dist":{"shasum":"4ffce84cea93aeddc6d66096475764c8ddb99214","tarball":"https://registry.npmjs.org/@standardserver/fastify/-/fastify-0.8.3.tgz","fileCount":6,"integrity":"sha512-bFfFJk1lWFRLgD4Rd/VOyyZm+87xyKdmRuHRVb8TDZw8JjWFrmBzFTJe+amrkrCZ+pzC3VIMy/XNSJoIkuygjA==","signatures":[{"sig":"MEUCIFQQR6X5lsBA4xJqTzQAeLqJFhpf3x+GN8EitZkFrHVQAiEAva+EminP7pFMygj0OBfUeaqdeWVFR4PWg5vXuNcRPHc=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@standardserver%2ffastify@0.8.3","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":30975},"type":"module","exports":{".":{"types":"./dist/index.d.mts","import":"./dist/index.mjs","default":"./dist/index.mjs"},"./package.json":"./package.json"},"funding":["https://github.com/sponsors/dinwwwh","https://opencollective.com/middleapi"],"scripts":{"build":"unbuild","type:check":"tsc -b"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:99990171-5e83-42aa-9fa6-87ced349a000"}},"repository":{"url":"git+https://github.com/middleapi/standardserver.git","type":"git","directory":"packages/fastify"},"description":"Fastify adapter for Standard Server: transport-agnostic requests, responses, and streaming on top of Fastify's request and reply objects","directories":{},"sideEffects":false,"dependencies":{"@standardserver/core":"0.8.3","@standardserver/node":"0.8.3"},"_hasShrinkwrap":false,"devDependencies":{"fastify":"^5.11.0","supertest":"^7.1.4","@types/node":"^26.4.1","@fastify/cookie":"^11.1.2","@types/supertest":"^7.2.1"},"peerDependencies":{"fastify":">=5.6.1"},"peerDependenciesMeta":{"fastify":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/fastify_0.8.3_1788597388258_0.025707502394090476","host":"s3://npm-registry-packages-npm-production"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."}},"time":{"created":"2026-08-01T13:14:40.997Z","modified":"2026-09-06T08:38:39.788Z","0.6.0":"2026-08-01T13:14:41.343Z","0.7.0":"2026-08-03T03:13:13.629Z","0.7.1":"2026-08-03T05:23:49.910Z","0.8.0":"2026-08-14T07:53:02.197Z","0.8.1":"2026-08-26T04:03:55.738Z","0.8.2":"2026-08-27T01:39:56.679Z","0.8.3":"2026-09-05T08:36:28.388Z"},"license":"MIT","homepage":"https://standardserver.dev","keywords":["standardserver","fastify","adapter","http","server","request","response","streaming","sse","typescript"],"repository":{"url":"git+https://github.com/middleapi/standardserver.git","type":"git","directory":"packages/fastify"},"description":"Fastify adapter for Standard Server: transport-agnostic requests, responses, and streaming on top of Fastify's request and reply objects","maintainers":[{"name":"dinwwwh","email":"dinwwwh@gmail.com"}],"readme":"# @standardserver/fastify\n\n<div align=\"center\">\n  <a href=\"https://codecov.io/gh/middleapi/standardserver\">\n    <img alt=\"codecov\" src=\"https://codecov.io/gh/middleapi/standardserver/branch/main/graph/badge.svg\">\n  </a>\n  <a href=\"https://www.npmjs.com/package/@standardserver/fastify\">\n    <img alt=\"weekly downloads\" src=\"https://img.shields.io/npm/dw/%40standardserver%2Ffastify?logo=npm\" />\n  </a>\n  <a href=\"https://app.codspeed.io/middleapi/standardserver?utm_source=badge\">\n    <img src=\"https://img.shields.io/endpoint?url=https://codspeed.io/badge.json\" alt=\"CodSpeed\" />\n  </a>\n  <a href=\"https://github.com/middleapi/standardserver/blob/main/LICENSE\">\n    <img alt=\"MIT License\" src=\"https://img.shields.io/github/license/middleapi/standardserver?logo=open-source-initiative\" />\n  </a>\n  <a href=\"https://discord.gg/TXEbwRBvQn\">\n    <img alt=\"Discord\" src=\"https://img.shields.io/discord/1308966753044398161?color=7389D8&label&logo=discord&logoColor=ffffff\" />\n  </a>\n  <a href=\"https://deepwiki.com/middleapi/standardserver\">\n    <img src=\"https://deepwiki.com/badge.svg\" alt=\"Ask DeepWiki\">\n  </a>\n</div>\n\n`@standardserver/fastify` adapts Fastify request and reply objects to the transport-agnostic request and response model defined by Standard Server.\n\nStandard Server provides a unified interface for client-server communication across HTTP and message-based transports. It lets you write handlers against the same request, response, body, and streaming primitives whether the underlying transport is the Fetch API, Node.js HTTP, HTTP/2, or a peer-style message channel.\n\nStandard Server ships as a small ecosystem of packages:\n\n| Package                                                                                                             | Description                                                                 |\n| ------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------- |\n| [`@standardserver/core`](https://github.com/middleapi/standardserver/blob/main/packages/core/README.md)             | The shared contract: types, body parsing rules, validators, and SSE helpers |\n| [`@standardserver/fetch`](https://github.com/middleapi/standardserver/blob/main/packages/fetch/README.md)           | Fetch API adapter for browsers, workers, and other Fetch-based runtimes     |\n| [`@standardserver/node`](https://github.com/middleapi/standardserver/blob/main/packages/node/README.md)             | Node.js HTTP and HTTP/2 adapter                                             |\n| [`@standardserver/fastify`](https://github.com/middleapi/standardserver/blob/main/packages/fastify/README.md)       | Fastify adapter built on the Node.js adapter                                |\n| [`@standardserver/aws-lambda`](https://github.com/middleapi/standardserver/blob/main/packages/aws-lambda/README.md) | AWS Lambda adapter with response streaming                                  |\n| [`@standardserver/peer`](https://github.com/middleapi/standardserver/blob/main/packages/peer/README.md)             | Message-based adapter for WebSocket, MessagePort, and custom transports     |\n| [`@standardserver/shared`](https://github.com/middleapi/standardserver/blob/main/packages/shared/README.md)         | Internal utilities shared across the ecosystem                              |\n\nThis package is the Fastify adapter for that model. It builds on [`@standardserver/node`](https://github.com/middleapi/standardserver/blob/main/packages/node/README.md), reusing the same body, URL, and abort-signal primitives, while routing the response back through Fastify's reply lifecycle so hooks, plugins, and serializers keep working. Both `Fastify()` and `Fastify({ http2: true })` instances are supported.\n\n`fastify` is a peer dependency, so the adapter always uses the Fastify version installed in your project.\n\n## Package overview\n\nThe package exposes two helpers and their option shapes:\n\n| Group                   | Exports                                                                                                 | Purpose                                                    |\n| ----------------------- | ------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------- |\n| Request and response    | `toStandardLazyRequest()`, `sendStandardResponse()`                                                     | Adapt Fastify request and reply objects to Standard Server |\n| Types and option shapes | `AnyFastifyRequest`, `AnyFastifyReply`, `FastifyRequest`, `FastifyReply`, `SendStandardResponseOptions` | Type handler inputs and serializer options                 |\n\nBoth helpers accept `AnyFastifyRequest` and `AnyFastifyReply`, which are `FastifyRequest` and `FastifyReply` widened over every raw server. That is what lets the same call site work for `Fastify()`, `Fastify({ http2: true })`, typed route generics, hooks, and encapsulated plugins alike.\n\nLower-level helpers such as `toStandardBody()`, `toNodeHttpBody()`, and `toEventStream()` are not re-exported here — import them from [`@standardserver/node`](https://github.com/middleapi/standardserver/blob/main/packages/node/README.md) when you need them.\n\n## Server-side request handling\n\nUse `toStandardLazyRequest()` to convert an incoming Fastify request into a `StandardLazyRequest`, then `sendStandardResponse()` to write the resulting `StandardResponse` back through the reply.\n\n```ts\nimport type { StandardLazyRequest, StandardResponse } from '@standardserver/core'\nimport { sendStandardResponse, toStandardLazyRequest } from '@standardserver/fastify'\nimport Fastify from 'fastify'\n\nasync function handle(request: StandardLazyRequest): Promise<StandardResponse> {\n  const body = await request.resolveBody()\n\n  return {\n    status: 200,\n    headers: { 'content-type': 'application/json' },\n    body: {\n      ok: true,\n      method: request.method,\n      url: request.url,\n      received: body,\n    },\n  }\n}\n\nconst fastify = Fastify()\n\nfastify.all('/*', async (req, reply) => {\n  const standardRequest = toStandardLazyRequest(req, reply)\n  const standardResponse = await handle(standardRequest)\n\n  await sendStandardResponse(reply, standardResponse, {/** options */})\n})\n\nawait fastify.listen({ port: 3000 })\n```\n\n`sendStandardResponse()` resolves once the response is fully flushed, and rejects if the underlying connection errors. Do not return a value from the route handler afterwards — Fastify would try to send a second response.\n\n> [!TIP]\n> When sending responses, you can pass additional options such as event-stream keep-alive.\n\n## Resolving Body\n\n`resolveBody(hint?)` returns the body Fastify already parsed with its own content type parsers, if there is one. Otherwise it falls back to `toStandardBody()` from `@standardserver/node`, which follows the shared Standard Server resolution rules: an explicit `hint` wins, then the [`standard-server` header](https://github.com/middleapi/standardserver/blob/main/packages/core/README.md#the-standard-server-header), then inference from the content headers. See [how body parsing works](https://github.com/middleapi/standardserver/blob/main/packages/core/README.md#how-body-parsing-works) in the core README for the full algorithm.\n\nBecause Fastify's own parsers win, a `hint` only applies to bodies Fastify left unparsed. Fastify ships parsers for `application/json` and `text/plain`, and rejects every other content type with `415 Unsupported Media Type` unless you register one. To let the adapter own body parsing end to end, register a catch-all parser that leaves the body untouched:\n\n```ts\n// optional: also drop fastify's built-in json and text/plain parsers\nfastify.removeAllContentTypeParsers()\n\nfastify.addContentTypeParser('*', (req, payload, done) => {\n  done(null, undefined)\n})\n```\n\nRegister it inside an encapsulated plugin if you only want it to apply to the routes that serve Standard Server handlers.\n\n> [!TIP]\n> For efficient communication, set the `standard-server` header to explicitly hint the body type, especially for file or binary streaming. For example, if you upload a file with a common `content-type` such as `application/json` but omit the `standard-server` header, the server may interpret it as JSON and parse it unexpectedly.\n\n## Fastify behavior to be aware of\n\nFastify owns the reply lifecycle, so a few of its rules apply to the response the adapter writes:\n\n- **Empty `content-type` is rejected.** A `Blob` or `File` without a type is sent with an empty `content-type` header, which Fastify answers with `415 Unsupported Media Type` before your handler runs. Normalize it first if clients may send one:\n\n  ```ts\n  fastify.addHook('onRequest', async (req) => {\n    if (req.headers['content-type'] === '') {\n      delete req.headers['content-type']\n    }\n  })\n  ```\n\n- **JSON responses gain a charset.** Fastify rewrites any `content-type` whose media type contains `json` to include `; charset=utf-8`. The payload itself is never serialized twice, because the adapter always hands Fastify an already-encoded string or stream.\n- **`set-cookie` is merged, not replaced.** Cookies set by plugins such as `@fastify/cookie` are kept, and the ones on your `StandardResponse` are appended to them. Every other header is overwritten.\n- **Streams are managed by Fastify.** Streaming bodies are piped and destroyed by Fastify itself, including when the client aborts mid-response.\n\n## Learn more\n\nFor the project overview and the shared contract, see the [core documentation](https://github.com/middleapi/standardserver/blob/main/packages/core/README.md). For the Node.js primitives this adapter is built on, see the [Node.js adapter documentation](https://github.com/middleapi/standardserver/blob/main/packages/node/README.md).\n\n## Sponsors\n\nLike what we build over at [middleapi](https://github.com/middleapi)? You can help keep it going through [GitHub Sponsors](https://github.com/sponsors/dinwwwh) or [Open Collective](https://opencollective.com/middleapi). Every bit helps! 🚀\n\n<table>\n  <tr>\n   <td width=\"2000\"><a href=\"https://screenshotone.com/?ref=middleapi&amp;utm_source=middleapi&amp;utm_medium=sponsor\" target=\"_blank\" rel=\"noopener\" title=\"The screenshot API for developers\"><img src=\"https://avatars.githubusercontent.com/u/97035603?v=4\" width=\"64\" align=\"left\" hspace=\"12\" alt=\"ScreenshotOne.com\"/><b>ScreenshotOne.com</b></a><br /><sub>The screenshot API for developers</sub></td>\n  </tr>\n  <tr>\n   <td width=\"2000\"><a href=\"https://yuzu.health/careers?ref=middleapi&amp;utm_source=middleapi&amp;utm_medium=sponsor\" target=\"_blank\" rel=\"noopener sponsored\" title=\"We&#39;re hiring NYC based engineers\"><img src=\"https://avatars.githubusercontent.com/u/102488956?v=4\" width=\"64\" align=\"left\" hspace=\"12\" alt=\"Yuzu\"/><b>Yuzu</b></a><br /><sub>We&#39;re hiring NYC based engineers</sub></td>\n  </tr>\n  <tr>\n   <td width=\"2000\"><a href=\"https://misskey.io/?ref=middleapi&amp;utm_source=middleapi&amp;utm_medium=sponsor\" target=\"_blank\" rel=\"noopener sponsored\" title=\"Decentralized microblogging SNS born on Earth\"><img src=\"https://github.com/MisskeyIO.png\" width=\"64\" align=\"left\" hspace=\"12\" alt=\"MisskeyHQ\"/><b>MisskeyHQ</b></a><br /><sub>Decentralized microblogging SNS born on Earth</sub></td>\n  </tr>\n</table>\n\n### Organization Sponsors\n\n<table>\n  <tr>\n   <td align=\"center\"><a href=\"https://lnmarkets.com/?ref=middleapi&amp;utm_source=middleapi&amp;utm_medium=sponsor\" target=\"_blank\" rel=\"noopener sponsored\" title=\"LN Markets\"><img src=\"https://avatars.githubusercontent.com/u/70597625?v=4\" width=\"167\" alt=\"LN Markets\"/><br />LN Markets</a></td>\n  </tr>\n</table>\n\n### Sponsors\n\n<table>\n  <tr>\n   <td align=\"center\"><a href=\"https://github.com/hrmcdonald?ref=middleapi&amp;utm_source=middleapi&amp;utm_medium=sponsor\" target=\"_blank\" rel=\"noopener sponsored\" title=\"Reece McDonald\"><img src=\"https://avatars.githubusercontent.com/u/39349270?v=4\" width=\"139\" alt=\"Reece McDonald\"/><br />Reece McDonald</a></td>\n   <td align=\"center\"><a href=\"https://soymilk.party/?ref=middleapi&amp;utm_source=middleapi&amp;utm_medium=sponsor\" target=\"_blank\" rel=\"noopener sponsored\" title=\"あわわわとーにゅ\"><img src=\"https://avatars.githubusercontent.com/u/17376330?u=de3353804be889f009f7e0a1582daf04d0ab292d&amp;v=4\" width=\"139\" alt=\"あわわわとーにゅ\"/><br />あわわわとーにゅ</a></td>\n   <td align=\"center\"><a href=\"https://github.com/nicognaW?ref=middleapi&amp;utm_source=middleapi&amp;utm_medium=sponsor\" target=\"_blank\" rel=\"noopener sponsored\" title=\"nk\"><img src=\"https://avatars.githubusercontent.com/u/66731869?u=4699bda3a9092d3ec34fbd959450767bcc8b8b6d&amp;v=4\" width=\"139\" alt=\"nk\"/><br />nk</a></td>\n   <td align=\"center\"><a href=\"https://supastarter.dev/?ref=middleapi&amp;utm_source=middleapi&amp;utm_medium=sponsor\" target=\"_blank\" rel=\"noopener sponsored\" title=\"supastarter\"><img src=\"https://avatars.githubusercontent.com/u/110960143?v=4\" width=\"139\" alt=\"supastarter\"/><br />supastarter</a></td>\n   <td align=\"center\"><a href=\"https://github.com/divmgl?ref=middleapi&amp;utm_source=middleapi&amp;utm_medium=sponsor\" target=\"_blank\" rel=\"noopener sponsored\" title=\"Dexter Miguel\"><img src=\"https://avatars.githubusercontent.com/u/5452298?u=645993204be8696c085ecf0d228c3062efe2ed65&amp;v=4\" width=\"139\" alt=\"Dexter Miguel\"/><br />Dexter Miguel</a></td>\n   <td align=\"center\"><a href=\"https://github.com/herrfugbaum?ref=middleapi&amp;utm_source=middleapi&amp;utm_medium=sponsor\" target=\"_blank\" rel=\"noopener sponsored\" title=\"herrfugbaum\"><img src=\"https://avatars.githubusercontent.com/u/12859776?u=644dc1666d0220bc0468eb0de3c56b919f635b16&amp;v=4\" width=\"139\" alt=\"herrfugbaum\"/><br />herrfugbaum</a></td>\n  </tr>\n  <tr>\n   <td align=\"center\"><a href=\"https://laststance.io/?ref=middleapi&amp;utm_source=middleapi&amp;utm_medium=sponsor\" target=\"_blank\" rel=\"noopener sponsored\" title=\"Ryota Murakami\"><img src=\"https://avatars.githubusercontent.com/u/5501268?u=599389e03340734325726ca3f8f423c021d47d7f&amp;v=4\" width=\"139\" alt=\"Ryota Murakami\"/><br />Ryota Murakami</a></td>\n   <td align=\"center\"><a href=\"https://cra.mr/?ref=middleapi&amp;utm_source=middleapi&amp;utm_medium=sponsor\" target=\"_blank\" rel=\"noopener sponsored\" title=\"David Cramer\"><img src=\"https://avatars.githubusercontent.com/u/23610?v=4\" width=\"139\" alt=\"David Cramer\"/><br />David Cramer</a></td>\n   <td align=\"center\"><a href=\"https://valerii15298.github.io/?ref=middleapi&amp;utm_source=middleapi&amp;utm_medium=sponsor\" target=\"_blank\" rel=\"noopener sponsored\" title=\"Valerii Petryniak\"><img src=\"https://avatars.githubusercontent.com/u/44531564?u=88ac74d9bacd20401518441907acad21063cd397&amp;v=4\" width=\"139\" alt=\"Valerii Petryniak\"/><br />Valerii Petryniak</a></td>\n   <td align=\"center\"><a href=\"https://letstri.dev/?ref=middleapi&amp;utm_source=middleapi&amp;utm_medium=sponsor\" target=\"_blank\" rel=\"noopener sponsored\" title=\"Valerii Strilets\"><img src=\"https://avatars.githubusercontent.com/u/13253748?u=c7b10399ccc8f8081e24db94ec32cd9858e86ac3&amp;v=4\" width=\"139\" alt=\"Valerii Strilets\"/><br />Valerii Strilets</a></td>\n   <td align=\"center\"><a href=\"https://blacklight.sh/?ref=middleapi&amp;utm_source=middleapi&amp;utm_medium=sponsor\" target=\"_blank\" rel=\"noopener sponsored\" title=\"Kyle Mistele\"><img src=\"https://avatars.githubusercontent.com/u/18430555?u=3afebeb81de666e35aaac3ed46f14159d7603ffb&amp;v=4\" width=\"139\" alt=\"Kyle Mistele\"/><br />Kyle Mistele</a></td>\n   <td align=\"center\"><a href=\"https://github.com/christ12938?ref=middleapi&amp;utm_source=middleapi&amp;utm_medium=sponsor\" target=\"_blank\" rel=\"noopener sponsored\" title=\"christ12938\"><img src=\"https://avatars.githubusercontent.com/u/25758598?v=4\" width=\"139\" alt=\"christ12938\"/><br />christ12938</a></td>\n  </tr>\n  <tr>\n   <td align=\"center\"><a href=\"https://github.com/Ryanjso?ref=middleapi&amp;utm_source=middleapi&amp;utm_medium=sponsor\" target=\"_blank\" rel=\"noopener sponsored\" title=\"Ryan Soderberg\"><img src=\"https://avatars.githubusercontent.com/u/39172778?u=5ed913c31d57e7221b75784abcad48c7ebddde27&amp;v=4\" width=\"139\" alt=\"Ryan Soderberg\"/><br />Ryan Soderberg</a></td>\n   <td align=\"center\"><a href=\"https://github.com/itigoore01?ref=middleapi&amp;utm_source=middleapi&amp;utm_medium=sponsor\" target=\"_blank\" rel=\"noopener sponsored\" title=\"shota\"><img src=\"https://avatars.githubusercontent.com/u/11831107?u=c976a6dc7e055eb026304c46c99100ed22b0c8e0&amp;v=4\" width=\"139\" alt=\"shota\"/><br />shota</a></td>\n   <td align=\"center\"><a href=\"https://github.com/ellis-driscoll?ref=middleapi&amp;utm_source=middleapi&amp;utm_medium=sponsor\" target=\"_blank\" rel=\"noopener sponsored\" title=\"Ellis Driscoll\"><img src=\"https://avatars.githubusercontent.com/u/70685966?u=c5f95bc33b5991d9744abe00052542e4a2ed3cb9&amp;v=4\" width=\"139\" alt=\"Ellis Driscoll\"/><br />Ellis Driscoll</a></td>\n   <td align=\"center\"><a href=\"https://github.com/hoangbn?ref=middleapi&amp;utm_source=middleapi&amp;utm_medium=sponsor\" target=\"_blank\" rel=\"noopener sponsored\" title=\"Hoang Nguyen\"><img src=\"https://avatars.githubusercontent.com/u/38968280?u=c90084c6de65c56facabab7ba13a72a49ddbc3e4&amp;v=4\" width=\"139\" alt=\"Hoang Nguyen\"/><br />Hoang Nguyen</a></td>\n   <td align=\"center\"><a href=\"https://opencollective.com/guest-ac41de3b?ref=middleapi&amp;utm_source=middleapi&amp;utm_medium=sponsor\" target=\"_blank\" rel=\"noopener sponsored\" title=\"Orestis Ioannou\"><img src=\"https://images.opencollective.com/guest-ac41de3b/avatar/460.png\" width=\"139\" alt=\"Orestis Ioannou\"/><br />Orestis Ioannou</a></td>\n  </tr>\n</table>\n\n### Backers\n\n<table>\n  <tr>\n   <td align=\"center\"><a href=\"https://github.com/rhinodavid?ref=middleapi&amp;utm_source=middleapi&amp;utm_medium=sponsor\" target=\"_blank\" rel=\"noopener sponsored\" title=\"David Walsh\"><img src=\"https://avatars.githubusercontent.com/u/5778036?u=b5521f07d2f88c3db2a0dae62b5f2f8357214af0&amp;v=4\" width=\"119\" alt=\"David Walsh\"/><br />David Walsh</a></td>\n   <td align=\"center\"><a href=\"https://github.com/IPv4Addr?ref=middleapi&amp;utm_source=middleapi&amp;utm_medium=sponsor\" target=\"_blank\" rel=\"noopener sponsored\" title=\"IPv4Addr\"><img src=\"https://avatars.githubusercontent.com/u/100147665?u=59996b72f69bb53063cb7e9ff8b8f898616cd94d&amp;v=4\" width=\"119\" alt=\"IPv4Addr\"/><br />IPv4Addr</a></td>\n   <td align=\"center\"><a href=\"https://robbevaes.be/?ref=middleapi&amp;utm_source=middleapi&amp;utm_medium=sponsor\" target=\"_blank\" rel=\"noopener sponsored\" title=\"Robbe Vaes\"><img src=\"https://avatars.githubusercontent.com/u/44748019?u=e0232402c045ad4eac7cbd217f1f47e083103b89&amp;v=4\" width=\"119\" alt=\"Robbe Vaes\"/><br />Robbe Vaes</a></td>\n   <td align=\"center\"><a href=\"https://github.com/aidansunbury?ref=middleapi&amp;utm_source=middleapi&amp;utm_medium=sponsor\" target=\"_blank\" rel=\"noopener sponsored\" title=\"Aidan Sunbury\"><img src=\"https://avatars.githubusercontent.com/u/64103161?v=4\" width=\"119\" alt=\"Aidan Sunbury\"/><br />Aidan Sunbury</a></td>\n   <td align=\"center\"><a href=\"https://github.com/soonoo?ref=middleapi&amp;utm_source=middleapi&amp;utm_medium=sponsor\" target=\"_blank\" rel=\"noopener sponsored\" title=\"soonoo\"><img src=\"https://avatars.githubusercontent.com/u/5436405?u=5d0b4aa955c87e30e6bda7f0cccae5402da99528&amp;v=4\" width=\"119\" alt=\"soonoo\"/><br />soonoo</a></td>\n   <td align=\"center\"><a href=\"https://kevinporten.dev/?ref=middleapi&amp;utm_source=middleapi&amp;utm_medium=sponsor\" target=\"_blank\" rel=\"noopener sponsored\" title=\"Kevin Porten\"><img src=\"https://avatars.githubusercontent.com/u/1839345?u=dc2263d5cfe0d927ce1a0be04a1d55dd6b55405c&amp;v=4\" width=\"119\" alt=\"Kevin Porten\"/><br />Kevin Porten</a></td>\n   <td align=\"center\"><a href=\"https://github.com/pumpkinlink?ref=middleapi&amp;utm_source=middleapi&amp;utm_medium=sponsor\" target=\"_blank\" rel=\"noopener sponsored\" title=\"Denis\"><img src=\"https://avatars.githubusercontent.com/u/11864620?u=5f47bbe6c65d0f6f5cf011021490238e4b0593d0&amp;v=4\" width=\"119\" alt=\"Denis\"/><br />Denis</a></td>\n  </tr>\n  <tr>\n   <td align=\"center\"><a href=\"https://github.com/christopher-kapic?ref=middleapi&amp;utm_source=middleapi&amp;utm_medium=sponsor\" target=\"_blank\" rel=\"noopener sponsored\" title=\"Christopher Kapic\"><img src=\"https://avatars.githubusercontent.com/u/59740769?u=e7ad4b72b5bf6c9eb1644c26dbf3332a8f987377&amp;v=4\" width=\"119\" alt=\"Christopher Kapic\"/><br />Christopher Kapic</a></td>\n   <td align=\"center\"><a href=\"http://ballingt.com/?ref=middleapi&amp;utm_source=middleapi&amp;utm_medium=sponsor\" target=\"_blank\" rel=\"noopener sponsored\" title=\"Tom Ballinger\"><img src=\"https://avatars.githubusercontent.com/u/458879?u=4b045ac75d721b6ac2b42a74d7d37f61f0414031&amp;v=4\" width=\"119\" alt=\"Tom Ballinger\"/><br />Tom Ballinger</a></td>\n   <td align=\"center\"><a href=\"https://lee-sam.com/?ref=middleapi&amp;utm_source=middleapi&amp;utm_medium=sponsor\" target=\"_blank\" rel=\"noopener sponsored\" title=\"Sam\"><img src=\"https://avatars.githubusercontent.com/u/102863520?u=3c89611f549d5070be232eb4532f690c8f2e7a65&amp;v=4\" width=\"119\" alt=\"Sam\"/><br />Sam</a></td>\n   <td align=\"center\"><a href=\"https://github.com/Titoine?ref=middleapi&amp;utm_source=middleapi&amp;utm_medium=sponsor\" target=\"_blank\" rel=\"noopener sponsored\" title=\"Titoine\"><img src=\"https://avatars.githubusercontent.com/u/3514286?u=1bb1e86b0c99c8a1121372e56d51a177eea12191&amp;v=4\" width=\"119\" alt=\"Titoine\"/><br />Titoine</a></td>\n   <td align=\"center\"><a href=\"https://rigtch.fm/?ref=middleapi&amp;utm_source=middleapi&amp;utm_medium=sponsor\" target=\"_blank\" rel=\"noopener sponsored\" title=\"Igor Makowski\"><img src=\"https://avatars.githubusercontent.com/u/56691628?u=ee8c879478f7c151b9156aef6c74243fa3e247a8&amp;v=4\" width=\"119\" alt=\"Igor Makowski\"/><br />Igor Makowski</a></td>\n   <td align=\"center\"><a href=\"https://blog.cwang.io/?ref=middleapi&amp;utm_source=middleapi&amp;utm_medium=sponsor\" target=\"_blank\" rel=\"noopener sponsored\" title=\"hanayashiki\"><img src=\"https://avatars.githubusercontent.com/u/26056783?u=06c3b9205a16fd41a871e82da1cc2a09306d53f5&amp;v=4\" width=\"119\" alt=\"hanayashiki\"/><br />hanayashiki</a></td>\n   <td align=\"center\"><a href=\"https://dubinets.io/?ref=middleapi&amp;utm_source=middleapi&amp;utm_medium=sponsor\" target=\"_blank\" rel=\"noopener sponsored\" title=\"Lev Dubinets\"><img src=\"https://avatars.githubusercontent.com/u/3114081?u=f547f5d5012cab54851f1b1ad72d10e537f78fc2&amp;v=4\" width=\"119\" alt=\"Lev Dubinets\"/><br />Lev Dubinets</a></td>\n  </tr>\n  <tr>\n   <td align=\"center\"><a href=\"https://kellychan.im/?ref=middleapi&amp;utm_source=middleapi&amp;utm_medium=sponsor\" target=\"_blank\" rel=\"noopener sponsored\" title=\"Kelly Peilin Chan\"><img src=\"https://avatars.githubusercontent.com/u/520852?u=6b0f7105f694e7b5cacf410a3f04c7044b469dc8&amp;v=4\" width=\"119\" alt=\"Kelly Peilin Chan\"/><br />Kelly Peilin Chan</a></td>\n   <td align=\"center\"><a href=\"https://guyariely.com/?ref=middleapi&amp;utm_source=middleapi&amp;utm_medium=sponsor\" target=\"_blank\" rel=\"noopener sponsored\" title=\"Guy Ariely\"><img src=\"https://avatars.githubusercontent.com/u/42813496?u=edb6b7f563bf28e160a290832e7da57c0506f8ca&amp;v=4\" width=\"119\" alt=\"Guy Ariely\"/><br />Guy Ariely</a></td>\n   <td align=\"center\"><a href=\"https://paulsenon.com/?ref=middleapi&amp;utm_source=middleapi&amp;utm_medium=sponsor\" target=\"_blank\" rel=\"noopener sponsored\" title=\"PaulSenon\"><img src=\"https://avatars.githubusercontent.com/u/19531087?u=6385741eb91d200b8c513ec6045482e301767ca6&amp;v=4\" width=\"119\" alt=\"PaulSenon\"/><br />PaulSenon</a></td>\n   <td align=\"center\"><a href=\"https://piscis.dev/?ref=middleapi&amp;utm_source=middleapi&amp;utm_medium=sponsor\" target=\"_blank\" rel=\"noopener sponsored\" title=\"Alex\"><img src=\"https://avatars.githubusercontent.com/u/326163?u=b245f368bd940cf51d08c0b6bf55f8257f359437&amp;v=4\" width=\"119\" alt=\"Alex\"/><br />Alex</a></td>\n   <td align=\"center\"><a href=\"https://opensource.gubanov.eu/?ref=middleapi&amp;utm_source=middleapi&amp;utm_medium=sponsor\" target=\"_blank\" rel=\"noopener sponsored\" title=\"Andrey Gubanov\"><img src=\"https://avatars.githubusercontent.com/u/1082083?u=c5f2daf7ebece498e85c83367bb37b4e10e2649d&amp;v=4\" width=\"119\" alt=\"Andrey Gubanov\"/><br />Andrey Gubanov</a></td>\n  </tr>\n</table>\n\nWith thanks to [36 past sponsors](https://htmlpreview.github.io/?https://github.com/middleapi/static/blob/main/sponsors.svg) who helped get us here.\n\n## License\n\nDistributed under the MIT License. See [LICENCE](https://github.com/middleapi/standardserver/blob/main/LICENCE) for more information.\n","readmeFilename":""}