Skip to content

Fastify

Fastify 4.26 and later, 5 included: CI runs it on 4.26.0, 5.0.0 and the newest. Your server’s code does not change: follow Setup to install the package, profile the Prisma client and add the preload. A complete app, Fastify 5 with an N+1 to find, is in examples/fastify.

{
"scripts": {
"dev": "tsx watch --import query-profiler/register src/server.ts",
"start": "node dist/server.js"
}
}

In plain JavaScript, node --watch --import query-profiler/register src/server.js. Other watchers are in Setup.

Fastify({ http2: true }) is profiled on Node 22.17+ and 24.2+, where Node publishes HTTP/2 requests too, and CI runs it. Its responses carry no X-Debug-Token: find the request on the profiler’s page.

With @fastify/cors, a page on another origin can read X-Debug-Token: the preload exposes it. If you set exposedHeaders, your list replaces it, so add the token there:

await app.register(cors, { origin: "http://localhost:5173", exposedHeaders: ["X-Debug-Token"] });

In production no response carries it, so the extra name does nothing.