Sharing State Across Fastify Plugins Without Breaking Encapsulation
Fastify encapsulates plugins by default. Learn when to use fastify-plugin to share decorators and connections, and how to verify the boundary.
ReadMeFeed / Community knowledge
Real questions. Useful conversations. Find the people who know your stack.
Fastify encapsulates plugins by default. Learn when to use fastify-plugin to share decorators and connections, and how to verify the boundary.
Use JSON Schema as the contract in Fastify for automatic request validation with AJV and pre-compiled response serialization with fast-json-stringify, scoped inside encapsulated plugins for modular, type-safe routes.
Fastify's plugin encapsulation scopes decorators and hooks — but never routes. Learn what it actually isolates, how to share deliberately with fastify-plugin, and how to verify it.