{"id":10391,"library":"fastify","title":"Fastify Web Framework","description":"Fastify is a high-performance web framework for Node.js, known for its low overhead and powerful plugin architecture. It provides an excellent developer experience with a focus on speed and security. Currently in stable version 5.8.5, Fastify undergoes active development with frequent releases, including critical security patches.","status":"active","version":"5.8.5","language":"javascript","source_language":"en","source_url":"https://github.com/fastify/fastify","tags":["javascript","web","framework","json","schema","open","api","typescript"],"install":[{"cmd":"npm install fastify","lang":"bash","label":"npm"},{"cmd":"yarn add fastify","lang":"bash","label":"yarn"},{"cmd":"pnpm add fastify","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":null,"wrong":"const Fastify = require('fastify')","symbol":"Fastify","correct":"import Fastify from 'fastify'"}],"quickstart":{"code":"import Fastify from 'fastify';\n\nconst fastify = Fastify({\n  logger: true\n});\n\nfastify.get('/', async (request, reply) => {\n  reply.send({ hello: 'world' });\n});\n\nfastify.listen({ port: 3000 }, (err, address) => {\n  if (err) {\n    fastify.log.error(err);\n    process.exit(1);\n  }\n  console.log(`Server listening on ${address}`);\n});","lang":"typescript","description":"This example sets up a basic Fastify server listening on port 3000 and defines a root route that returns a JSON object."},"warnings":[{"fix":"Ensure all incoming `Content-Type` headers strictly adhere to RFC 9110. Consider adding custom content-type parsers if legacy or non-standard types are necessary.","message":"Fastify now strictly enforces `Content-Type` header parsing as per RFC 9110. Malformed or non-standard `Content-Type` headers that previously worked may now be rejected.","severity":"breaking","affected_versions":">=5.7.2"},{"fix":"Consult the official Fastify v5 migration guide on `fastify.dev` for detailed steps and a comprehensive list of breaking changes before upgrading.","message":"Upgrading from Fastify v4 to v5 introduces significant breaking changes. The `main` branch on GitHub now exclusively tracks v5.","severity":"breaking","affected_versions":">4.x"},{"fix":"Regularly update your Fastify dependency to the latest patch release (e.g., `npm update fastify` or `yarn upgrade fastify`) and monitor Fastify's security advisories.","message":"Fastify regularly releases security patches for critical vulnerabilities (CVEs). It is essential to keep your Fastify package updated to the latest stable version to ensure application security.","severity":"gotcha","affected_versions":"*"}],"env_vars":null,"last_verified":"2026-04-18T00:00:00.000Z","next_check":"2026-07-17T00:00:00.000Z","problems":[{"fix":"Close the application currently using the port, or configure Fastify to listen on a different available port (e.g., `fastify.listen({ port: 8080 })`).","cause":"The specified port (e.g., 3000) for the Fastify server is already being used by another process.","error":"EADDRINUSE: address already in use :::3000"},{"fix":"Define a `fastify.get()`, `fastify.post()`, or other HTTP method handler for the requested path, or check for typos in the route path.","cause":"A request was made to an endpoint that does not have a defined Fastify route handler.","error":"{\"statusCode\":404,\"error\":\"Not Found\",\"message\":\"Route GET /your-path not found\"}"},{"fix":"Ensure client requests send well-formed `Content-Type` headers. If processing non-standard types is required, register a custom content type parser using `fastify.addContentTypeParser()`.","cause":"An incoming request had a `Content-Type` header that did not conform to RFC 9110, specifically since Fastify v5.7.2 implemented stricter parsing.","error":"FastifyError [FST_ERR_CTP_INVALID_MEDIA_TYPE]: The Content-Type header is invalid. It must be in the form 'type/subtype[; parameter=value]'"},{"fix":"Ensure the payload passed to `reply.send()` is a plain object, array, string, Buffer, or a Node.js readable stream. Fastify automatically JSON-stringifies plain objects/arrays.","cause":"`reply.send()` was called with a payload that Fastify cannot serialize or send directly (e.g., a non-plain object, a promise that doesn't resolve to a serializable type, or an unsupported stream).","error":"FastifyError [FST_ERR_REP_INVALID_PAYLOAD]: The payload is not a string or a buffer."}],"ecosystem":"npm"}