Info PPAAI App

Contributing to Documentation

How to add and edit documentation using Fumadocs

Contributing to Documentation

This project uses Fumadocs for documentation. The docs are integrated into the main application and served at /docs.

Documentation Structure

packages/docs/
├── content/
│   └── docs/          # MDX documentation files
│       ├── index.mdx
│       ├── architecture.mdx
│       ├── design-choices.mdx
│       ├── future-plans.mdx
│       └── contributing.mdx
├── source.config.ts   # Fumadocs configuration
└── package.json

Adding New Documentation

1. Create a New MDX File

Create a new .mdx file in packages/docs/content/docs/:

touch packages/docs/content/docs/your-topic.mdx

2. Add Frontmatter

Every documentation page needs frontmatter with title and description:

---
title: Your Topic Title
description: A brief description of what this page covers
---

# Your Topic Title

Your content here...

3. Write Content

Use standard Markdown with MDX enhancements:

Code Blocks

// Code blocks support syntax highlighting
export function example() {
  return "Hello, world!";
}

Callouts

Use blockquotes for callouts:

Note: This is an informational callout.

  • Internal: [Architecture](/docs/architecture)
  • External: [Fumadocs](https://fumadocs.vercel.app)

Lists and Tables

Standard Markdown lists and tables are supported.

4. Regenerate Docs

After adding or editing docs, regenerate the source files:

# From root
bun run docs:generate

# Or from web app
cd apps/web
bun run fumadocs-mdx

The dev server will automatically regenerate docs when you save changes.

Editing Existing Documentation

  1. Navigate to packages/docs/content/docs/
  2. Edit the .mdx file you want to change
  3. Save the file
  4. The dev server will hot-reload the changes

Documentation Best Practices

Writing Style

  • Be concise: Get to the point quickly
  • Use examples: Show code examples where relevant
  • Be consistent: Follow the existing documentation style
  • Update regularly: Keep docs in sync with code changes

File Naming

  • Use kebab-case: my-topic.mdx
  • Be descriptive: database-migrations.mdx not db.mdx
  • Group related topics in subdirectories if needed

Frontmatter Guidelines

---
title: Clear, Descriptive Title
description: One sentence summary (50-160 characters)
---

Fumadocs Features

Syntax Highlighting

Code blocks automatically get syntax highlighting with light/dark theme support:

bun install
bun run dev
import { auth } from '@info-ppaai-app/auth';

export async function getUser() {
  const session = await auth.api.getSession();
  return session?.user;
}

Table of Contents

Fumadocs automatically generates a table of contents from your headings. Use proper heading hierarchy:

  • # for page title (h1)
  • ## for main sections (h2)
  • ### for subsections (h3)

The documentation includes built-in search functionality. All content is automatically indexed.

Local Development

Start Dev Server

bun run dev

Visit http://localhost:3000/docs to see your changes.

Build for Production

bun run build

This validates all documentation and generates static pages.

Troubleshooting

Docs Not Updating

If your changes aren't showing:

  1. Regenerate docs: bun run docs:generate
  2. Restart dev server: Ctrl+C then bun run dev
  3. Clear .source cache: rm -rf apps/web/.source packages/docs/.source

Syntax Errors

If you see build errors:

  • Check frontmatter is valid YAML
  • Ensure all code blocks are properly closed with ```
  • Validate MDX syntax at MDX Playground

Styling Issues

If styling looks broken:

  • Ensure you're using standard Markdown syntax
  • Check that code blocks specify a language
  • Verify heading hierarchy is correct

Resources