Configuration
JSDoc provides two configuration mechanisms that can be used together: command-line flags and a JSON configuration file. The configuration file is recommended for anything beyond simple one-off commands.
Command Line
All CLI flags, from -r (recurse) to --verbose and --debug.
Configuration File
The full jsdoc.json schema — source, opts, plugins, tags, and templates.
Default Template
Configure the built-in HTML template: layout, analytics, colour, and more.
Precedence
Command-line flags take precedence over values in the configuration file. Options set in the configuration file's opts block behave as defaults and are overridden by any equivalent CLI flag.
Minimal example
A minimal jsdoc.json that recursively processes a src/ folder and writes output to docs/:
{
"source": {
"include": ["src"],
"includePattern": ".+\\.js$"
},
"opts": {
"recurse": true,
"destination": "docs"
}
}
Run it with:
Run with config
npx jsdoc -c jsdoc.json