Overview
OpenDocs provides a unified model that transforms documentation from any programming language into a consistent, navigable structure. Instead of maintaining separate models for TypeScript, Rust, Go, Python, and other languages, OpenDocs defines five core components that work together to represent documentation universally:- DocSet - The root object in
opendocs.jsoncontaining metadata and projects - Project - Individual project in a monorepo (package, library, app)
- DocItem - Universal element representing any documentable code (classes, functions, methods, etc.)
- DocBlock - Structured documentation content extracted from code comments
- DocTag - Individual documentation tags (
@param,@returns,@deprecated)
Model Hierarchy
The five models form a hierarchical structure where each plays a specific role: Data Flow:- DocSet (the
opendocs.jsonfile) contains metadata and an array of Projects - Projects contain top-level DocItems (packages, modules, namespaces)
- DocItems nest hierarchically through the
itemsarray - Each DocItem references its parent container via ContainerRef
- DocItems link to their documentation via DocBlock
- DocBlocks organize tags in arrays for structured metadata
The Five Core Models
DocSet
The DocSet model represents theopendocs.json file - the entry point for your Documentation Set. This is the root object that contains metadata about the documentation and references all projects.
Purpose:
The DocSet model exists to:
- Provide a single entry point (
opendocs.json) for the entire Documentation Set - Store metadata about the documentation itself
- Organize multiple projects in monorepos
- Enable versioning and tracking of documentation changes
Project
The Project model represents an individual project within a Documentation Set. In monorepos, each package, library, or app is a separate Project. Each Project has its own language, version, and contains all DocItems that make up that project’s API reference.
Key use case - Monorepos:
The Project model was designed to support monorepos where a single Documentation Set contains multiple projects (packages, apps, libraries). Each project has its own identifier, language, and version while sharing a common documentation structure.
Organizational patterns:
- Use unique, descriptive IDs (e.g.,
"auth-service","web-sdk") - Specify the programming language for each project
- Organize top-level items logically (by module, package, or namespace)
- Use meaningful project names that match your package/repository
- Declare dependencies between projects for proper cross-referencing
- Include version information for documentation tracking
DocItem
The DocItem is the fundamental unit of documentation in OpenDocs. Everything is a DocItem - from entire modules down to individual method parameters. This unified approach works across all programming languages while preserving language-specific characteristics.
Universal abstraction:
Every documentation element, regardless of programming language, is represented as a DocItem:
- Rust:
struct,trait,impl-method - Go:
struct,interface,receiver-method - TypeScript:
class,interface,method,property - Python:
class,function,property
kind field enables complete language-specific typing without breaking the universal model:
DocBlock
DocBlock represents structured documentation content extracted from source code comments. It provides a unified format for documentation regardless of the original comment syntax (TSDoc, Javadoc, rustdoc, etc.).
Tag structure:
DocBlock organizes tags in a
Record<string, (string | DocTag)[]> where each tag can be either a simple string or a complex DocTag object.
DocTag
DocTag represents individual documentation tags. It supports both simple string values and complex parameter structures for tags like@param, @returns, and @deprecated.
Two types of tags:
Simple tags are just strings:
| Format | Syntax | Normalized To |
|---|---|---|
| TSDoc | @param width - The width | { name: "param", content: "The width", parameters: { name: "width" } } |
| Javadoc | @param width the width | Same DocTag structure |
| Python | :param width: The width:type width: int | Same structure, with type: "int" in parameters |
| Rustdoc | * \width` - The width` | Same DocTag structure |
| XMLDoc | <param name="width">The width</param> | Same DocTag structure |
ContainerRef
ContainerRef links DocItems to their parent containers, enabling proper navigation and context.How Models Work Together
Complete Hierarchy Example
Cross-Model References
- Parent-child relationships: DocItems contain child DocItems via the
itemsarray - Container links: DocItems reference their parent container via
container(ContainerRef) - Documentation links: DocItems link to their documentation via
docBlock(DocBlock) - Tag organization: DocBlocks organize tags in a
Record<string, (string | DocTag)[]>structure
Cross-Format Compatibility
OpenDocs maps documentation from different formats to the same DocBlock structure, enabling consistent rendering across languages.TSDoc → DocBlock
Source:Javadoc → DocBlock
Source:- Consistent rendering across languages
- Template compatibility
- Cross-format documentation migration
- Support for both simple metadata tags and complex structured data
Next Steps
- Learn about file organization for structuring your documentation
- Follow the implementation guide to build OpenDocs support for your language
- Explore examples to see the models in action

