# Extension points — fastify/fastify

> Canonical page: https://codevetter.com/unpack/fastify/extension-points

# Extension points — fastify/fastify

Scanned commit 19d5be0daf1c0daace758efe3ea788f924ca1224 (2026-09-29). Generated by codevetter codevetter 1.15.0 on 2026-10-02.

Source inspection; upstream code and tests were not executed.

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. — [fastify.js#L367-376](https://github.com/fastify/fastify/blob/19d5be0daf1c0daace758efe3ea788f924ca1224/fastify.js#L367-L376) [lib/plugin-override.js#L28-38](https://github.com/fastify/fastify/blob/19d5be0daf1c0daace758efe3ea788f924ca1224/lib/plugin-override.js#L28-L38)
- Plugin metadata is read from Symbol.for('plugin-meta'), while Symbol.for('skip-override') requests parent-scope reuse. — [lib/plugin-utils.js#L19-21](https://github.com/fastify/fastify/blob/19d5be0daf1c0daace758efe3ea788f924ca1224/lib/plugin-utils.js#L19-L21) [lib/plugin-utils.js#L61-63](https://github.com/fastify/fastify/blob/19d5be0daf1c0daace758efe3ea788f924ca1224/lib/plugin-utils.js#L61-L63) [lib/plugin-override.js#L29-35](https://github.com/fastify/fastify/blob/19d5be0daf1c0daace758efe3ea788f924ca1224/lib/plugin-override.js#L29-L35)
- registerPlugin validates async handler shape, Fastify version, required decorators, and declared plugin dependencies. — [lib/plugin-utils.js#L147-153](https://github.com/fastify/fastify/blob/19d5be0daf1c0daace758efe3ea788f924ca1224/lib/plugin-utils.js#L147-L153)
- onRegister hooks receive each new child instance and options after scope construction. — [lib/plugin-override.js#L63-73](https://github.com/fastify/fastify/blob/19d5be0daf1c0daace758efe3ea788f924ca1224/lib/plugin-override.js#L63-L73)
- onRoute hooks can inspect or alter route options before Context construction; lifecycle hooks combine instance and route handlers at preReady. — [lib/route.js#L292-297](https://github.com/fastify/fastify/blob/19d5be0daf1c0daace758efe3ea788f924ca1224/lib/route.js#L292-L297) [lib/route.js#L389-395](https://github.com/fastify/fastify/blob/19d5be0daf1c0daace758efe3ea788f924ca1224/lib/route.js#L389-L395)
- schemaController accepts a bucket factory and compiler factories; child controllers seed their schema bucket from parent schemas. — [lib/schema-controller.js#L30-35](https://github.com/fastify/fastify/blob/19d5be0daf1c0daace758efe3ea788f924ca1224/lib/schema-controller.js#L30-L35) [lib/schema-controller.js#L40-58](https://github.com/fastify/fastify/blob/19d5be0daf1c0daace758efe3ea788f924ca1224/lib/schema-controller.js#L40-L58)
- setValidatorCompiler and setSerializerCompiler clone compiler-factory configuration and adapt a supplied compiler into a reusable builder. — [lib/schema-controller.js#L75-95](https://github.com/fastify/fastify/blob/19d5be0daf1c0daace758efe3ea788f924ca1224/lib/schema-controller.js#L75-L95) [lib/schema-controller.js#L97-116](https://github.com/fastify/fastify/blob/19d5be0daf1c0daace758efe3ea788f924ca1224/lib/schema-controller.js#L97-L116)
- addContentTypeParser supports multiple content types and inherits the instance body limit; registration is rejected after startup. — [lib/content-type-parser.js#L365-384](https://github.com/fastify/fastify/blob/19d5be0daf1c0daace758efe3ea788f924ca1224/lib/content-type-parser.js#L365-L384)
- serverFactory receives the HTTP handler and options and returns a user-supplied transport server. — [lib/server.js#L308-312](https://github.com/fastify/fastify/blob/19d5be0daf1c0daace758efe3ea788f924ca1224/lib/server.js#L308-L312)
- Constraint strategies, child logger factories, decorators, and error handlers are exposed through instance methods. — [fastify.js#L266-288](https://github.com/fastify/fastify/blob/19d5be0daf1c0daace758efe3ea788f924ca1224/fastify.js#L266-L288)

Every claim links to its cited files at the pinned commit. Citations identify source evidence; they do not establish runtime correctness. Independent CodeVetter scan — not reviewed by upstream maintainers.

## Public product links

- [CodeVetter](https://codevetter.com/)
- [Download](https://codevetter.com/download)
- [Documentation](https://codevetter.com/docs/)
- [Source](https://github.com/Codevetter/codevetter)
