- "content": "---\ntitle: Local Docs\ndescription: Set up Plate's documentation locally for version-controlled, AI-enhanced development.\n---\n\nHost Plate's documentation locally to integrate it directly with your project. This setup ensures your team works with documentation that matches your Plate version while enabling AI tools to better understand and assist with your codebase.\n\n## Why Host Documentation Locally?\n\nLocal documentation provides distinct advantages over external sites:\n\n* **Version Lock-In:** Keep documentation synchronized with your project's Plate version. Avoid confusion from features or APIs in newer, unadopted Plate releases.\n* **AI-Ready Development:**\n * **Better than `llms.txt`:** While dumping docs into a single text file is common for LLM context, this breaks down with large documentation (exceeding typical 100k token limits). Our structured, local setup lets AI tools access exactly what they need.\n * **Direct Access for AI Tools:** Your AI-assisted IDE gets direct access to version-specific documentation, enabling accurate code generation and contextual help with your Plate setup.\n * **Structured for AI Tasks:** AI tools can help with tasks like translating docs, creating summaries, or updating documentation between Plate versions.\n* **Customization & Control:** Modify documentation appearance and structure to match your project needs.\n* **Easy Updates:** Treat documentation like code - review, update, and version control it with your codebase.\n* **Fast Access:** Get reliable, quick access to documentation.\n* **Central Hub:** Keep Plate docs alongside documentation for other libraries in one place.\n\n## Setup Guide\n\nThere are two ways to set up local documentation:\n\n### Option 1: Docs App\n\nThis option sets up a complete documentation site using Fumadocs, providing a searchable, navigable interface.\n\n<Steps>\n\n#### Create Fumadocs App\n\nSet up a Fumadocs app which provides the Next.js-based framework for your documentation site:\n\n```bash\npnpm create fumadocs-app\n```\n\nDuring setup:\n- **Name:** Enter `docs` when prompted\n- **Choose your preferred options** (defaults work well)\n- The wizard will create a `docs` directory with all necessary files\n\nNavigate to your newly created `docs` directory:\n\n```bash\ncd docs\n```\n\nFor detailed Fumadocs setup, see the [Fumadocs UI documentation](https://fumadocs.dev/docs/ui).\n\n#### Create `components.json`\n\nIn your docs directory, create a `components.json` file. You have two options:\n\n**Option A: Command line**\n\n```bash\necho '{\\n \"$schema\": \"https://ui.shadcn.com/schema.json\",\\n \"style\": \"new-york\",\\n \"rsc\": true,\\n \"tsx\": true,\\n \"tailwind\": {\\n \"config\": \"\",\\n \"css\": \"app/global.css\",\\n \"baseColor\": \"neutral\",\\n \"cssVariables\": true,\\n \"prefix\": \"\"\\n },\\n \"aliases\": {\\n \"components\": \"@/components\",\\n \"utils\": \"@/lib/utils\",\\n \"ui\": \"@/components/ui\",\\n \"lib\": \"@/lib\",\\n \"hooks\": \"@/hooks\"\\n },\\n \"iconLibrary\": \"lucide\"\\n}' > components.json\n```\n\n**Option B: Copy and paste**\n\nCreate a new file called `components.json` in your docs directory with this content:\n\n```json\n{\n \"$schema\": \"https://ui.shadcn.com/schema.json\",\n \"style\": \"new-york\",\n \"rsc\": true,\n \"tsx\": true,\n \"tailwind\": {\n \"config\": \"\",\n \"css\": \"app/global.css\",\n \"baseColor\": \"neutral\",\n \"cssVariables\": true,\n \"prefix\": \"\"\n },\n \"aliases\": {\n \"components\": \"@/components\",\n \"utils\": \"@/lib/utils\",\n \"ui\": \"@/components/ui\",\n \"lib\": \"@/lib\",\n \"hooks\": \"@/hooks\"\n },\n \"iconLibrary\": \"lucide\"\n}\n```\n\n#### Add Plate Documentation\n\nNow, fetch the Plate documentation files and necessary MDX components.\n\n```bash\nnpx shadcn@latest add https://platejs.org/r/fumadocs\n```\n\n<Callout type=\"warning\" title=\"Version-Specific Documentation\">\n The command above installs the **latest** Plate documentation. For projects on older Plate versions (minimum `v48.0.0`), specify your version:\n\n 1. Go to [Plate's public registry on GitHub](https://github.com/udecode/plate/tree/main/apps/www/public/r).\n 2. Use the tag switcher to select your Plate version.\n 3. Copy the versioned URL (e.g., [v48](https://github.com/udecode/plate/tree/%40udecode/plate%4048.0.5/apps/www/public/r)).\n 4. Replace `https://platejs.org/r/` in the `shadcn` command with this URL.\n</Callout>\n\n#### Run Fumadocs App\n\nStart the development server:\n\n```bash\npnpm run dev\n```\n\nYour documentation site will be available at:\n- Plate docs: `http://localhost:3000/docs/plate`\n\n#### Customize\n\nEnhance your docs with [Fumadocs features](https://fumadocs.dev/docs/ui#writing-content).\n\n</Steps>\n\n### Option 2: MDX Files Only\n\nIf you just want the documentation files without setting up a full site, you can add them directly to your existing project:\n\n```bash\n# Run from your project root (wherever you want the docs)\nnpx shadcn@latest add https://platejs.org/r/docs\n```\n\nThis will:\n- Install MDX documentation files in your project (typically in a `docs/` or similar directory)\n- Skip the Fumadocs setup entirely\n- Give you raw MDX files to use however you need\n\nUse cases:\n- Reference documentation directly in your codebase\n- Integrate with your existing documentation setup\n- Make docs available to AI tools for better context\n\n## Advanced Integration\n\n### MCP Integration\n\nEnable AI tools to work with your local documentation by adding the Plate server to your `.cursor/mcp.json` (or equivalent).\n\n```json\n{\n \"mcpServers\": {\n \"plate\": {\n \"description\": \"Plate editors, plugins, components and documentation\",\n \"type\": \"stdio\",\n \"command\": \"npx\",\n \"args\": [\"-y\", \"shadcn@canary\", \"registry:mcp\"],\n \"env\": {\n \"REGISTRY_URL\": \"https://platejs.org/r/registry.json\"\n }\n }\n }\n}\n```\n\nYour AI tools can then:\n* Access documentation context for better code assistance\n* Help manage and update documentation\n* Generate code with proper imports and configurations\n* Assist with editor setup and feature integration\n\nSee the [MCP Guide](/docs/installation/mcp) for more details.\n\n<Callout>\n Once configured, try asking your AI:\n ```bash\n \"Help me understand how the Plate AI plugin works\"\n \"How to create a custom plugin?\"\n \"What's new in the latest Plate version?\"\n ```\n</Callout>\n\n### Centralizing Multiple Documentations\n\nYour `content/docs/` directory can host documentation for multiple libraries. Replicate the process for Plate to add docs for other internal or external tools:\n\n```plaintext\ncontent/\n└── docs/\n ├── plate/ # Plate documentation\n │ └── ...\n ├── other-library/ # Documentation for another library\n │ └── ...\n └── index.mdx # Main landing page for all docs\n```\n\nThis creates a unified, version-controlled knowledge base for your project stack.",
0 commit comments