CodeVetter · Repo Unpack · Extension points
fastify/fastify
Plugins and encapsulation are the main composition mechanism. Public hooks, decorators, parsers, schema compilers, and constraint strategies offer narrower extension seams. Transport and error handling can also be replaced. These facilities have lifecycle and inheritance rules that extensions must preserve.
- register is Avvio's exposed use API, and override implements Fastify-specific plugin encapsulation.
- Plugin metadata is read from Symbol.for('plugin-meta'), while Symbol.for('skip-override') requests parent-scope reuse.
- registerPlugin validates async handler shape, Fastify version, required decorators, and declared plugin dependencies.
- onRegister hooks receive each new child instance and options after scope construction.
- onRoute hooks can inspect or alter route options before Context construction; lifecycle hooks combine instance and route handlers at preReady.
- schemaController accepts a bucket factory and compiler factories; child controllers seed their schema bucket from parent schemas.
- setValidatorCompiler and setSerializerCompiler clone compiler-factory configuration and adapt a supplied compiler into a reusable builder.
- addContentTypeParser supports multiple content types and inherits the instance body limit; registration is rejected after startup.
- serverFactory receives the HTTP handler and options and returns a user-supplied transport server.
- Constraint strategies, child logger factories, decorators, and error handlers are exposed through instance methods.