Guidelines, best practices, and common pitfalls to avoid when working with Node.js and Fastify. Use when developing APIs, reviewing Fastify code, or refactoring.
console.log for Loggingconsole.log, console.error in production.request.log or fastify.log) which uses Pino (async, fast).schema in route options.fastify instance properties directly inside request handlers.decorateRequest or request-scoped context.fastify-plugin (fp) to break encapsulation when you want to share decorators, but understand Fastify's encapsulation model (DAG) to keep plugins isolated when needed.this context in Fastify (though standard usage often relies on request/reply args).(request, reply) => ... over relying on this.fastify.setErrorHandler to centralize error formatting.await or return the promise.SIGINT / SIGTERM.fastify.close().