FastifyInstance Type — fastify Architecture
Architecture documentation for the FastifyInstance type/interface in instance.d.ts from the fastify codebase.
Entity Profile
Dependency Diagram
graph TD f04f71b7_d555_fd4e_727a_af424f0a2d32["FastifyInstance"] 4e9bf84a_5251_4fe5_a2a2_55aee9ba1a06["instance.d.ts"] f04f71b7_d555_fd4e_727a_af424f0a2d32 -->|defined in| 4e9bf84a_5251_4fe5_a2a2_55aee9ba1a06 style f04f71b7_d555_fd4e_727a_af424f0a2d32 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
types/instance.d.ts lines 120–609
export interface FastifyInstance<
RawServer extends RawServerBase = RawServerDefault,
RawRequest extends RawRequestDefaultExpression<RawServer> = RawRequestDefaultExpression<RawServer>,
RawReply extends RawReplyDefaultExpression<RawServer> = RawReplyDefaultExpression<RawServer>,
Logger extends FastifyBaseLogger = FastifyBaseLogger,
TypeProvider extends FastifyTypeProvider = FastifyTypeProviderDefault
> {
server: RawServer;
pluginName: string;
prefix: string;
version: string;
log: Logger;
listeningOrigin: string;
addresses(): AddressInfo[]
withTypeProvider<Provider extends FastifyTypeProvider>(): FastifyInstance<RawServer, RawRequest, RawReply, Logger, Provider>;
addSchema(schema: unknown): FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>;
getSchema(schemaId: string): unknown;
getSchemas(): Record<string, unknown>;
after(): FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider> & SafePromiseLike<undefined>;
after(afterListener: (err: Error | null) => void): FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>;
close(): Promise<undefined>;
close(closeListener: () => void): undefined;
/** Alias for {@linkcode FastifyInstance.close()} */
// @ts-ignore - type only available for @types/node >=17 or typescript >= 5.2
[Symbol.asyncDispose](): Promise<undefined>;
// should be able to define something useful with the decorator getter/setter pattern using Generics to enforce the users function returns what they expect it to
decorate: DecorationMethod<FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>>;
decorateRequest: DecorationMethod<FastifyRequest, FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>>;
decorateReply: DecorationMethod<FastifyReply, FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>>;
getDecorator<T>(name: string | symbol): T;
hasDecorator(decorator: string | symbol): boolean;
hasRequestDecorator(decorator: string | symbol): boolean;
hasReplyDecorator(decorator: string | symbol): boolean;
hasPlugin(name: string): boolean;
addConstraintStrategy(strategy: ConstraintStrategy<FindMyWayVersion<RawServer>, unknown>): void;
hasConstraintStrategy(strategyName: string): boolean;
inject(opts: InjectOptions | string, cb: LightMyRequestCallback): void;
inject(opts: InjectOptions | string): Promise<LightMyRequestResponse>;
inject(): LightMyRequestChain;
listen(opts: FastifyListenOptions, callback: (err: Error | null, address: string) => void): void;
listen(opts?: FastifyListenOptions): Promise<string>;
listen(callback: (err: Error | null, address: string) => void): void;
ready(): FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider> & SafePromiseLike<undefined>;
ready(readyListener: (err: Error | null) => void | Promise<void>): FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>;
register: FastifyRegister<FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider> & SafePromiseLike<undefined>>;
routing(req: RawRequest, res: RawReply): void;
route<
RouteGeneric extends RouteGenericInterface = RouteGenericInterface,
ContextConfig = ContextConfigDefault,
const SchemaCompiler extends FastifySchema = FastifySchema
>(opts: RouteOptions<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider, Logger>): FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>;
delete: RouteShorthandMethod<RawServer, RawRequest, RawReply, TypeProvider, Logger>;
get: RouteShorthandMethod<RawServer, RawRequest, RawReply, TypeProvider, Logger>;
head: RouteShorthandMethod<RawServer, RawRequest, RawReply, TypeProvider, Logger>;
patch: RouteShorthandMethod<RawServer, RawRequest, RawReply, TypeProvider, Logger>;
post: RouteShorthandMethod<RawServer, RawRequest, RawReply, TypeProvider, Logger>;
put: RouteShorthandMethod<RawServer, RawRequest, RawReply, TypeProvider, Logger>;
options: RouteShorthandMethod<RawServer, RawRequest, RawReply, TypeProvider, Logger>;
propfind: RouteShorthandMethod<RawServer, RawRequest, RawReply, TypeProvider, Logger>;
proppatch: RouteShorthandMethod<RawServer, RawRequest, RawReply, TypeProvider, Logger>;
mkcalendar: RouteShorthandMethod<RawServer, RawRequest, RawReply, TypeProvider, Logger>;
mkcol: RouteShorthandMethod<RawServer, RawRequest, RawReply, TypeProvider, Logger>;
copy: RouteShorthandMethod<RawServer, RawRequest, RawReply, TypeProvider, Logger>;
move: RouteShorthandMethod<RawServer, RawRequest, RawReply, TypeProvider, Logger>;
lock: RouteShorthandMethod<RawServer, RawRequest, RawReply, TypeProvider, Logger>;
Defined In
Source
Frequently Asked Questions
What is the FastifyInstance type?
FastifyInstance is a type/interface in the fastify codebase, defined in types/instance.d.ts.
Where is FastifyInstance defined?
FastifyInstance is defined in types/instance.d.ts at line 120.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free