Skip to main content

Output Structure


When docsgen runs, it writes a structured set of files into your outDir. Understanding this structure helps when configuring sidebars, debugging generation issues, or integrating the importer remark plugin.


Single Package

For a project with one package, the output looks like:

docs/api/
options.json
<package-title>/
docs.json
package-config.json
index.mdx
Classes/
_category_.json
MyClass.mdx
Functions/
_category_.json
myFunction.mdx
Types/
_category_.json
MyType.mdx
Enums/
_category_.json
MyEnum.mdx
Variables/
_category_.json
myVariable.mdx

Monorepo (Multiple Packages)

With multiple packages and addMonorepoPage: true:

docs/api/
options.json
index.mdx # Monorepo index listing all packages
core/
docs.json
package-config.json
index.mdx # Package README-based index
Classes/
...
Functions/
...
react/
docs.json
package-config.json
index.mdx
Hooks/
...
Types/
...

File Descriptions

options.json

Serialized PluginOptions used during generation. The importer remark plugin reads this file to resolve @import directives. Contains package metadata, output paths, and configuration.

docs.json

TypeDoc JSON reflection output for a package. This is the raw data that drives MDX page generation. One file per package, located in the package's subdirectory.

package-config.json

Metadata about the package (PkgMeta):

{
"title": "core",
"packageDocsJsonPath": "docs/api/core/docs.json",
"packageDocsDir": "docs/api/core"
}

index.mdx (Package)

Generated from the package's README file. Only created when addPackagePage is true (or hasPackagePage is true on the package).

index.mdx (Monorepo)

Lists all packages with their logos and descriptions. Only created when addMonorepoPage is true and there are multiple packages.

category.json

Docusaurus category metadata files. Control the sidebar position and label of category folders. Generated from orderCategories configuration:

{
"position": 2
}

Symbol MDX Pages

Each exported symbol gets its own .mdx file with frontmatter:

---
sidebar_position: 1
title: MyClass
sidebar_label: MyClass
---

The page content is structured by the page template for that symbol's kind (class, function, component, etc.), including sections like intro, parameters, properties, methods, returns, and usage.


Category Folders

Symbols are organized into folders by their TypeDoc reflection kind:

KindDefault Folder
ClassesClasses/
FunctionsFunctions/
InterfacesInterfaces/
Type AliasesTypes/
EnumerationsEnums/
VariablesVariables/

You can remap these using kindMapper. For example, functions starting with use can be placed in a Hooks/ folder instead.

Categories listed in excludeCategories (default: ["Namespaces"]) are skipped entirely.


Custom Output Directories

Use the per-package outDir option to place a package's output in a different location than the main outDir. This is useful for integrating generated docs into specific sidebar sections:

{
title: "hooks",
dir: "../packages/hooks",
entryPath: "src/index.ts",
outDir: "docs/hooks", // placed outside the main API directory
}
Summary

docsgen produces options.json, per-package docs.json and package-config.json, category folders with _category_.json, and individual MDX files per symbol. The structure integrates with Docusaurus autogenerated sidebars out of the box.