A couple of weeks ago I shared nestjs-docfy here, a library that moves Swagger decorators out of NestJS controllers into companion *.controller.docs.ts files, plus docfy-ui, an AI-first reference UI with a "Copy for AI" button on every endpoint. The response was great, and two specific limitations came up repeatedly: Fastify wasn't supported, and reloading a deep-linked endpoint page in docfy-ui broke. I said I'd rather flag those than have people find out mid-deploy.
0.4.0 closes both.
Fastify support for docfy-ui
DocfyUiModule.setup() was Express-only. It now works on Fastify apps too, through a scoped @fastify/static registration — the same package @nestjs/swagger itself already relies on for Fastify's Swagger UI support:
npm install @fastify/static
import { NestFactory } from '@nestjs/core';
import { FastifyAdapter, NestFastifyApplication } from '@nestjs/platform-fastify';
import { DocfyUiModule } from 'nestjs-docfy';
const app = await NestFactory.create<NestFastifyApplication>(AppModule, new FastifyAdapter());
DocfyUiModule.setup('/docs', app);
await app.listen(3000);
Same call, same "Copy for AI" button, same zero-config /api-json discovery — just works on either adapter now.
One Fastify-specific thing worth knowing: SwaggerModule.setup() registers its own /api-json route too. On Express, whichever route wins is whoever registered first, silently. On Fastify, registering the same route twice throws FST_ERR_DUPLICATED_ROUTE at startup instead — order alone won't save you. If you're combining Fastify with a static, pre-patched spec (staticSpecPath, for webpack: true builds), point SwaggerModule.setup() at a different jsonDocumentUrl so it doesn't also claim /api-json.
Deep-link reload, fixed
If you mounted the UI outside the root — DocfyUiModule.setup('/docs', app) — and reloaded a specific endpoint's page directly by URL instead of navigating there client-side, you'd get a 404. Routing inside DocfyUiModule was reworked to handle the SPA fallback properly for both adapters, so a hard reload on a deep route now resolves the same as client-side navigation.
Also new: a proper docs site
The README carried the full API reference on its own for a while, which worked but wasn't great for actually browsing. There's now a dedicated docs site — same content, organized as an actual reference with search, instead of one long scroll.
Nothing else changes: same install, same DocfyUiModule.setup('/docs', app), same zero backend coupling — it still just consumes an OpenAPI 3.0/3.1 document, so it works with any server that exposes one, not just NestJS.
npm install nestjs-docfy
npm install docfy-ui
🔗 nestjs-docfy on GitHub · 📦 npm package · 📖 docs
If Fastify or the deep-link bug was the thing holding you back, this release should clear it.

Top comments (0)