Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Sep 25, 2025

Implements automated TypeScript API documentation generation using TypeDoc, seamlessly integrated into the existing Docusaurus website. This addresses the issue where developers had to manually navigate source files to understand frontend configuration interfaces.

Problem Solved

Previously, developers needed to manually navigate to frontend/src/app/shared/types/core/environment/mina-env.type.ts to understand the TypeScript interfaces like MinaEnv, MinaNode, and FeaturesConfig. The existing documentation contained copied code examples that required manual synchronization with source code changes.

Solution Implemented

  • Automated API Generation: Set up TypeDoc with typedoc-plugin-markdown to automatically generate comprehensive API documentation from TypeScript source files
  • Docusaurus Integration: Generated markdown files integrate seamlessly with the existing documentation structure under Frontend Development → TypeScript API
  • JSDoc Preservation: All JSDoc comments, examples, and type information are preserved and beautifully formatted
  • Cross-References: Working links between related types (MinaEnvMinaNodeFeaturesConfig) and direct links to GitHub source code
  • Build System Integration: Enhanced Makefile with new targets for TypeScript documentation generation

Key Features

Generated Documentation Structure:

website/docs/developers/frontend/api/
├── README.md                    # API overview with links to all types
├── interfaces/
│   ├── MinaEnv.md              # Main environment configuration interface  
│   └── MinaNode.md             # Single node configuration interface
└── type-aliases/
    ├── FeaturesConfig.md       # Feature flags configuration type
    └── FeatureType.md          # Union type of feature names

Build Integration:

  • make docs-typescript - Generate TypeScript API documentation
  • make docs-build - Build complete website including TypeScript APIs
  • make docs-serve - Serve documentation with TypeScript APIs included
  • make docs-clean - Clean all documentation artifacts

Developer Experience:

  • Searchable: Full-text search works across all API documentation
  • Linkable: Deep links to specific interfaces, properties, and code examples
  • Maintainable: Documentation automatically stays synchronized with source code
  • Professional: Clean formatting with syntax highlighting and preserved JSDoc examples

Technical Implementation

The solution uses TypeDoc to process TypeScript source files and generate markdown documentation that integrates with Docusaurus. Key configuration files:

  • website/typedoc.json - TypeDoc configuration for API generation
  • website/tsconfig.typedoc.json - Isolated TypeScript configuration for documentation
  • website/src/typedoc-entry.ts - Entry point for documentation generation
  • Updated website/sidebars.ts with Frontend Development section

Future Expansion

The foundation is now in place to easily expand documentation to include additional TypeScript interfaces, Angular services, and component APIs by simply adding entry points to the TypeDoc configuration.

![TypeScript API Documentation](https://github.com/user-attachments/assets/1ea89609-c692-46c9-aaea-ce25a6b2a3dc)

Screenshot shows the generated FeaturesConfig type documentation with preserved JSDoc comments, working code examples, syntax highlighting, and seamless integration with the existing website design.

This implementation eliminates the need for developers to manually navigate source files and provides comprehensive, automatically synchronized TypeScript API documentation that integrates perfectly with the existing documentation workflow.

Original prompt

This section details on the original issue you should resolve

<issue_title>Add TypeScript API documentation generation to website</issue_title>
<issue_description>## Problem

The frontend uses TypeScript interfaces to define configuration parameters (e.g., MinaEnv, MinaNode, FeaturesConfig in frontend/src/app/shared/types/core/environment/mina-env.type.ts), but developers must manually navigate to the source files to understand the complete API.

The current environment configuration documentation at website/docs/developers/frontend/environment-configuration.mdx contains copied code examples that need manual synchronization with the source code.

Solution

Integrate TypeScript documentation generation into the Docusaurus website to:

  1. Automatically generate API reference from TypeScript interfaces and JSDoc comments
  2. Keep documentation synchronized with source code changes
  3. Provide better developer experience with searchable, linkable API docs
  4. Reduce maintenance overhead by eliminating manually copied code examples

Implementation Options

Option 1: TypeDoc + docusaurus-plugin-typedoc (Recommended)

  • Native TypeScript support with JSDoc parsing
  • Seamless Docusaurus integration
  • Automatic sidebar generation
  • Maintains type links and cross-references

Option 2: Custom script using TypeScript Compiler API

  • Full control over output format
  • Generate custom Docusaurus markdown pages
  • Can integrate with existing documentation structure

Scope

Initial focus:

  • frontend/src/app/shared/types/core/environment/mina-env.type.ts (environment configuration types)
  • Generate API reference at website/docs/developers/frontend/api/
  • Add to frontend sidebar navigation

Future expansion:

  • Other frontend TypeScript interfaces and services
  • Node/core Rust documentation (separate effort)

Acceptance Criteria

  • TypeScript interfaces automatically generate API documentation
  • Generated docs integrate with Docusaurus website navigation
  • JSDoc comments are preserved and formatted correctly
  • Documentation builds are integrated with CI/CD
  • Links between generated API docs and manual documentation work correctly

Labels

  • enhancement
  • documentation
  • frontend</issue_description>

Comments on the Issue (you are @copilot in this section)

Fixes #1471

💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

@Copilot Copilot AI changed the title [WIP] Add TypeScript API documentation generation to website Add TypeScript API documentation generation to website Sep 25, 2025
@Copilot Copilot AI requested a review from dannywillems September 25, 2025 14:05
Copilot finished work on behalf of dannywillems September 25, 2025 14:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

Add TypeScript API documentation generation to website

2 participants