This project uses multiple documentation tools to provide comprehensive documentation for both JavaScript/TypeScript API and C++ native code.
- README.md - Main project documentation and quick start guide
- API.md - Complete API reference (manually maintained)
- docs/api/ - TypeDoc-generated JavaScript/TypeScript API documentation
- docs/html/ - Doxygen-generated C++ native code documentation
Purpose: Generate API documentation from TypeScript definitions and JSDoc comments.
Configuration: typedoc.json
Generate:
npm run docs:jsOutput: docs/api/ (HTML documentation)
Features:
- Extracts documentation from
types.d.tsand JSDoc comments - Type-safe documentation with full type information
- Interactive search and navigation
- Automatically deployed to GitHub Pages
Purpose: Generate documentation for C++ native bindings.
Configuration: Doxyfile
Generate:
npm run docs:cppOutput: docs/html/ (HTML documentation)
Features:
- Documents C++ classes, functions, and structures
- Source code browsing
- Call graphs and dependency diagrams
- Automatically deployed to GitHub Pages
npm run docs # Generates both TypeDoc and Doxygen docsDocumentation is automatically generated and deployed when you push to main:
- ✅ Auto-generates on every push to
main - ✅ Auto-deploys to GitHub Pages
- ✅ Runs on PRs to verify docs generate correctly
- ✅ Monitors source files, config files, and README
No manual steps required! Just push your code and documentation updates automatically.
For local development with auto-regeneration:
# Watch mode (TypeDoc only - regenerates on file changes)
npm run docs:watch
# Or use the auto-docs script (both TypeDoc and Doxygen)
./scripts/auto-docs.shThe auto-docs script watches for changes and regenerates both docs automatically.
Documentation is automatically generated before publishing to npm:
npm publish # Automatically runs 'npm run docs' firstTypeDoc (JavaScript API):
npm run docs:serve
# Visit http://localhost:8000Doxygen (C++ Code):
npm run docs:serve:cpp
# Visit http://localhost:8001- JavaScript API Docs: GitHub Pages - API
- C++ Native Docs: GitHub Pages - Native
Add JSDoc comments to your code:
/**
* Add vectors to the index
* @param {Float32Array} vectors - Single vector or batch of vectors
* @returns {Promise<void>}
* @example
* await index.add(new Float32Array([1, 2, 3, 4]));
*/
async add(vectors) {
// ...
}TypeDoc will automatically extract:
- Parameter types from TypeScript definitions
- Return types
- JSDoc comments
- Examples
Add Doxygen comments:
/**
* Add vectors to the index
* @param vectors Pointer to float array (n * dims elements)
* @param n Number of vectors
* @throws std::runtime_error if index is disposed
*/
void Add(const float* vectors, size_t n);Both documentation types are automatically deployed to GitHub Pages:
- TypeDoc: Deployed via
.github/workflows/docs-typedoc.yml - Doxygen: Deployed via
.github/workflows/docs.yml
Documentation is updated automatically when:
- Code is pushed to
mainbranch - Source files are modified
- Documentation configuration files are updated
- Keep JSDoc comments up-to-date - They're the source of truth for API docs
- Use TypeScript types - TypeDoc extracts types automatically
- Add examples - Use
@exampletags in JSDoc - Document parameters - Use
@paramfor all parameters - Document return values - Use
@returnsfor return types - Document errors - Use
@throwsfor exceptions
# Install dependencies
npm install
# Check TypeDoc version
npx typedoc --version
# Generate with verbose output
npx typedoc --verbose# Check Doxygen installation
doxygen --version
# Generate with verbose output
doxygen Doxyfile 2>&1 | head -20- Check GitHub Actions workflow runs
- Verify GitHub Pages is enabled in repository settings
- Check for errors in workflow logs