Configuration
All adapters accept the same config object.
{
docsPath: '/docs', // URL where the docs UI is served
enabled: true, // Set false to disable; defaults to NODE_ENV !== 'production'
liveReload: false, // Re-discover routes on every docs hit
meta: {
title: 'My API',
version: '1.0.0',
description: 'Full description shown in the UI header',
},
exclude: ['/health', /^\/internal\/.*/], // Paths to hide from docs
groups: { // Group routes under named sections in the sidebar
Users: ['/users', '/users/:id'],
Products: '/products',
},
flows: [...], // Inline flow presets (see Request Flows)
flowsPath: './doctreen-flows', // Directory of *.json flow files
}Reference
| Option | Type | Default | Description |
|---|---|---|---|
docsPath | string | '/docs' | URL where the docs UI is served |
enabled | boolean | NODE_ENV !== 'production' | Set to false to disable docs entirely |
liveReload | boolean | false | Re-discover routes on every docs request |
meta.title | string | 'API Documentation' | Title shown in the UI header |
meta.version | string | '1.0.0' | Version label |
meta.description | string | '' | Description shown below the title |
exclude | string | RegExp | Array | [] | Routes to hide from the docs |
groups | Record<string, string | string[]> | {} | Group routes into named sidebar sections |
flows | FlowDefinition[] | null | Inline request-flow presets |
flowsPath | string | auto-detected | Directory of *.json flow files |
validate | boolean | false | Run runtime validation on every Zod-declared route |
drift | boolean | DriftConfig | env-dependent | Enable schema drift detection |
openapi | OpenAPIConfig | {} | Tags, servers, security schemes, callbacks/webhooks for the OpenAPI export |
headHtml | string | '' | Inject custom <head> HTML (analytics, favicons, OG tags) |
Disabling in production
By default enabled is false when NODE_ENV === 'production'. To serve docs
in production, set it explicitly:
expressAdapter(app, { enabled: true, meta: { title: 'My API', version: '1.0.0' } });Excluding routes
exclude accepts strings, regexes, or arrays of either:
expressAdapter(app, {
exclude: [
'/health',
'/metrics',
/^\/internal\/.*/,
],
});For per-route control while keeping the route reachable, use
hidden: true on
defineRoute / @DocRoute instead.