Skip to content

Migrate documentation site to Fumadocs with monorepo structure and shared content - #11

Merged
hotlong merged 11 commits into
mainfrom
copilot/setup-fumadocs-site
Jan 19, 2026
Merged

hotlong merged 11 commits into
mainfrom
copilot/setup-fumadocs-site

Conversation

Copilot AI commented Jan 18, 2026

Copy link
Copy Markdown
Contributor

Replace the custom @objectdocs/cli documentation tooling with Fumadocs, a modern Next.js-based documentation framework, and restructure it into a proper monorepo architecture under apps/docs/ while keeping documentation content at the root level for sharing.

Changes

Monorepo Structure

  • Multi-package Architecture: Moved all Next.js files to apps/docs/ to avoid polluting the root directory
  • Workspace Isolation: Documentation site now has its own package.json with isolated dependencies
  • Clean Separation: Clear boundary between protocol packages (packages/*) and applications (apps/*)
  • Shared Content: Documentation content remains at /content/docs/ (root level) for easy access and sharing across the repository

Core Infrastructure

  • Next.js 16 + App Router: Full static site generation for 136 documentation pages
  • Fumadocs MDX: Auto-compilation from /content/docs/ (root level) with type-safe collection handling
  • Tailwind CSS v4: New CSS architecture with @tailwindcss/postcss

Directory Structure

Repository Root:
├── content/docs/     # Documentation content (MDX files) - SHARED LOCATION
│   ├── concepts/
│   ├── references/
│   └── specifications/
└── apps/docs/
    ├── app/              # Next.js App Router
    ├── source.config.ts  # Fumadocs collection config (references ../../content/docs)
    ├── next.config.mjs   # Next.js configuration
    ├── tailwind.config.js
    ├── postcss.config.mjs
    ├── tsconfig.json
    └── package.json      # Isolated dependencies

Configuration

// apps/docs/source.config.ts - Collection definition
export const docs = defineDocs({
  dir: '../../content/docs',  // References root-level content
}) as any; // Workaround for pnpm zod@4 type portability

// apps/docs/app/source.ts - Loader setup
import { docs } from 'fumadocs-mdx:collections/server';
export const source = loader({
  baseUrl: '/docs',
  source: (docs as any).toFumadocsSource(),
});

UI Components

  • Collapsible sidebar with auto-generated navigation from meta.json files
  • Search (⌘K), theme toggle, GitHub integration
  • MDX components (Callout, Card, Cards) rendered via fumadocs-ui/mdx

Build Output

Route (app)
├ ○ /
└ ● /docs/[[...slug]] (136 pages)
  ├ /docs
  ├ /docs/concepts/*
  ├ /docs/references/*
  └ /docs/specifications/*

Workspace Configuration

  • Updated pnpm-workspace.yaml to include apps/*
  • Root package.json scripts use workspace filters: pnpm --filter @objectstack/docs
  • Root package.json includes shared dependencies (lucide-react) used by MDX files
  • Root tsconfig.json excludes apps directory
  • .gitignore updated for apps structure

Screenshot

Scripts

Scripts remain the same from repository root:

pnpm docs:dev    # Start development server
pnpm docs:build  # Build for production
pnpm docs:start  # Start production server

Benefits

  1. Clean Root Directory: No Next.js files in repository root
  2. Shared Content: Documentation content at /content/docs/ accessible to other tools and workflows
  3. Workspace Isolation: Each app/package manages its own dependencies
  4. Scalability: Easy to add more apps (e.g., apps/playground, apps/studio)
  5. Standard Pattern: Follows Turborepo/Nx monorepo conventions
  6. Maintainability: Clear separation of concerns

All existing MDX content preserved at the root level. The .source/ directory (auto-generated by Fumadocs) is gitignored.

Original prompt

帮我使用fumadocs搭建此文档站点


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@vercel

vercel Bot commented Jan 18, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
spec Error Error Jan 19, 2026 5:28am

Request Review

Co-authored-by: huangyiirene <7665279+huangyiirene@users.noreply.github.com>
…rver

Co-authored-by: huangyiirene <7665279+huangyiirene@users.noreply.github.com>
Copilot AI changed the title [WIP] Add setup for Fumadocs documentation site Migrate documentation site from custom @objectdocs/cli to Fumadocs Jan 18, 2026
Copilot AI requested a review from huangyiirene January 18, 2026 17:46
@hotlong

hotlong commented Jan 19, 2026

Copy link
Copy Markdown
Contributor

@copilot nextjs项目使用多包架构放到apps/docs,不要污染根目录

Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>

Copilot AI commented Jan 19, 2026

Copy link
Copy Markdown
Contributor Author

@copilot nextjs项目使用多包架构放到apps/docs,不要污染根目录

Done! The Next.js documentation site has been moved to apps/docs/ following monorepo best practices.

Changes:

  • ✅ All Next.js files moved to apps/docs/
  • ✅ Documentation content now in apps/docs/content/
  • ✅ Root directory cleaned up
  • ✅ Workspace configuration updated
  • ✅ Scripts still work from root: pnpm docs:dev, pnpm docs:build

See commit 3124fe9 for the complete restructuring.

Documentation Site

Copilot AI changed the title Migrate documentation site from custom @objectdocs/cli to Fumadocs Migrate documentation site to Fumadocs with monorepo structure (apps/docs) Jan 19, 2026
Copilot AI requested a review from hotlong January 19, 2026 01:02
@hotlong

hotlong commented Jan 19, 2026

Copy link
Copy Markdown
Contributor

@copilot 我的文档还是放在很目录,不要换位置 /content/docs

Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>

Copilot AI commented Jan 19, 2026

Copy link
Copy Markdown
Contributor Author

@copilot 我的文档还是放在很目录,不要换位置 /content/docs

Done! Documentation content is now kept at the root directory /content/docs/ as requested.

Changes:

  • ✅ Content moved back to /content/docs/ (root level)
  • apps/docs/source.config.ts updated to reference ../../content/docs
  • lucide-react added to root dependencies (required by MDX files)
  • ✅ Build verified: All 136 pages generated successfully

The Next.js app remains in apps/docs/ but references the shared content at the root. This provides the best of both worlds: clean app structure while keeping content accessible at the root level.

See commit c60ebe7 for the changes.

Documentation Site

Copilot AI changed the title Migrate documentation site to Fumadocs with monorepo structure (apps/docs) Migrate documentation site to Fumadocs with monorepo structure and shared content Jan 19, 2026
…mprove documentation formatting, and refine build scripts
This was referenced Sep 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants