Documentation Guide
This guide explains how documentation works in the TimeTiles project, including both manual documentation and auto-generated API references.
Documentation Structure
The TimeTiles documentation is divided into two main categories:
1. Manual Documentation
Location: Various directories under /apps/docs/content/
- Getting Started (
/getting-started/) - Installation, quick start guides - User Guide (
/user-guide/) - Features, use cases, tutorials - Developer Guide (
/developer-guide/) - Architecture, development guides - Admin Guide (
/admin-guide/) - Deployment, configuration, maintenance
These are hand-written MDX files that you edit directly.
2. Auto-generated API Documentation
Location: /apps/docs/content/reference/api/
- Generated from JSDoc comments in source code
- Created using TypeDoc with post-processing
- Should NOT be edited manually (changes will be overwritten)
Working with Manual Documentation
Creating New Pages
- Create an
.mdxfile in the appropriate directory:
apps/docs/content/developer-guide/guides/my-new-guide.mdx- Write your content using MDX (Markdown + JSX):
# My Guide Title
import { Callout } from "nextra/components";
<Callout type="info">Important information here</Callout>
## Section with code
\`\`\`typescript
const example = "code here"
\`\`\`- Update the navigation by editing
_meta.jsonin the same directory:
{
"existing-page": "Existing Page",
"my-new-guide": "My New Guide"
}Best Practices for Manual Docs
- Use clear, descriptive titles
- Include practical examples
- Add screenshots where helpful
- Link to related documentation
- Keep content up-to-date with code changes
Working with Auto-generated API Documentation
How It Works
- Source: JSDoc comments in TypeScript files
- Located in
apps/web/lib/,apps/web/app/api/
- Located in
- Generation: TypeDoc processes JSDoc comments
- Configuration in
apps/web/typedoc.json
- Configuration in
- Output: Markdown files in
apps/docs/content/reference/api/- Automatically organized by module
- Post-processing: Script cleans and converts output
- Converts
.mdto.mdx - Generates navigation files
- Converts
Writing JSDoc Comments
Currently, we primarily use file-level documentation to describe modules:
/**
* Handles import job processing with support for CSV and Excel files.
*
* This module manages the complete import pipeline including
* file parsing, schema detection, validation, geocoding, and event creation.
*
* @module
* @category Services
*/Key tags we use:
@module- Marks file-level documentation@category- Groups related modules (Services, Collections, Jobs, etc.)
Generating API Documentation
One-time Generation
# From project root
pnpm docs:api
# Or from docs directory
cd apps/docs
pnpm docs:apiWatch Mode (Development)
For active development on API documentation:
# From docs directory
cd apps/docs
pnpm docs:api:watchThis watches apps/web/lib/ for changes and automatically regenerates documentation.
What Gets Generated
The TypeDoc configuration (apps/web/typedoc.json) specifies:
- Entry points:
lib/collections,lib/services,lib/jobs,app/api, etc. - Output location:
apps/docs/content/reference/api/ - Exclusions: Test files, internal functions
- Organization: Grouped by category
Processing Steps
The pnpm docs:api command:
- Runs TypeDoc to generate markdown files
- Converts
.mdfiles to.mdx(viaclean-typedoc-output.ts) - Cleans up problematic references
- Navigation is derived from the file structure (Nextra auto-indexes without
_meta.json)
Git Configuration
What’s Tracked vs Ignored
The .gitignore excludes all generated API documentation:
apps/docs/content/reference/api/**/*.md
apps/docs/content/reference/api/**/*.mdx
apps/docs/content/reference/api/**/_meta.json
!apps/docs/content/reference/api/index.mdxEverything in the API reference directory is regenerated from source code on each build.
This means:
- ✅ Generated docs don’t clutter git history
- ✅ Can regenerate anytime from source
- ✅ Navigation is derived from file structure (Nextra auto-indexes directories)
- ✅ Consistent with source code structure
Note: The top-level content/reference/_meta.json IS manually maintained and tracked in git.
Development Workflow
When Adding New Features
- Write the code with comprehensive JSDoc comments
- Run tests to ensure everything works
- Generate docs with
pnpm docs:api - Write guides if needed (manual documentation)
- Review the generated documentation
- Commit code changes (docs are regenerated in CI)
When Updating Documentation
For API Changes:
- Update JSDoc comments in source files
- Run
pnpm docs:apito regenerate - Verify the output looks correct
- Commit the source code changes
For Guides/Tutorials:
- Edit the
.mdxfiles directly - Preview with
pnpm dev - Commit the documentation changes
CI/CD Integration
The documentation build process:
- Development: Docs generated on-demand
- Pull Requests: Docs built to verify they compile
- Production: Docs generated fresh during build
Build command:
{
"build": "pnpm docs:api && next build"
}This ensures documentation is always up-to-date with the code.
Troubleshooting
Common Issues
Generated docs look wrong
- Check JSDoc syntax in source files
- Verify TypeDoc configuration
- Run
pnpm docs:apiwith clean output directory
Navigation not updating
- Edit the appropriate
_meta.jsonfile - These are NOT auto-generated
Broken links in documentation
- Use relative paths for internal links
- Verify file exists after generation
- Check for typos in paths
TypeDoc warnings
- Missing type exports: Export the type from index
- Unresolved references: Ensure proper imports
- Private members documented: Add
@internaltag
Debugging Commands
# Clean generated docs
rm -rf apps/docs/content/reference/api/lib
rm -rf apps/docs/content/reference/api/app
# Regenerate fresh
cd apps/docs && pnpm docs:api
# Check what's ignored by git
git check-ignore apps/docs/content/reference/api/**
# See TypeDoc configuration
cat apps/web/typedoc.jsonBest Practices
For Module Documentation
- Clear purpose: Describe what the module does
- Keep updated: Update when functionality changes
- Use categories: Group related modules together
For Manual Documentation
- User-focused: Write for your audience
- Practical examples: Show real-world usage
- Visual aids: Include diagrams/screenshots where helpful
- Cross-reference: Link to related guides
- Keep concise: Avoid unnecessary verbosity
Documentation Review Checklist
- Module-level JSDoc comments added for new files
- Manual guides updated if behavior changed
- Navigation (
_meta.json) updated if needed - Links verified and working
- Generated docs reviewed for accuracy