Quick Start
Getting Started with Hanzo Docs
Introduction
Hanzo Docs (Hanzo docs) is a documentation framework, designed to be fast, flexible, and composes seamlessly into your React framework.
Hanzo Docs has different parts:
Hanzo Docs Core
Handles most of the logic, including document search, content source adapters, and Markdown extensions.
Hanzo Docs UI
The default theme of Hanzo Docs offers a beautiful look for documentation sites and interactive components.
Content Source
The source of your content, can be a CMS or local data layers like Hanzo Docs MDX (the official content source).
Hanzo Docs CLI
A command line tool to install UI components and automate things, useful for customizing layouts.
Want to learn more?
Read our in-depth What is Hanzo Docs introduction.
Terminology
Markdown/MDX: Markdown is a markup language for creating formatted text. Hanzo Docs natively supports Markdown and MDX (superset of Markdown).
Bun: A JavaScript runtime, we use it for running scripts.
Some basic knowledge of React.js would be useful for further customisations.
Automatic Installation
A minimum version of Node.js 22 required.
npm create @hanzo/docs-create-appIt will ask you the built-in template to use:
- React.js framework: Next.js, Waku, React Router, Tanstack Start.
- Content source: Hanzo Docs MDX.
A new fumadocs app should be initialized. Now you can start hacking!
From Existing Codebase?
You can follow the Manual Installation guide to get started.
Enjoy!
Create your first MDX file in the docs folder.
---
title: Hello World
---
## Yo what's upRun the app in development mode and see http://localhost:3000/docs.
npm run devFAQ
Some common questions you may encounter.
Make sure to upgrade Fumadocs when you've encountered any problems or trying out new features:
pnpm update -i -r --latestRouting is handled by your React framework, you need to change the routing structure first.
For example, in Next.js, rename the route (/docs/* -> /info/*):
Or rename from /docs/* to /* using a route group:
Finally, update the base URL of pages in source.ts:
import { loader } from '@hanzo/docs-core/source';
export const source = loader({
baseUrl: '/info', // to the new value
});We recommend to use Sidebar Tabs.
For Vite
There's some weird pre-bundling problems with Vite: #3910.
Make sure to exclude Fumadocs from pre-bundling and add it to noExternal:
import { defineConfig } from 'vite';
export default defineConfig({
resolve: {
// add other Fumadocs deps as needed
noExternal: ['@hanzo/docs-core', '@hanzo/docs-base-ui', '@hanzo/docs-openapi', '@hanzo/docs-base-ui'],
},
});For Next.js
Node.js 23.1 might have problems with Next.js, see #1021. Make sure to change your Node.js version.
Next.js turns dynamic route into static routes when generateStaticParams is configured.
Hence, it is as fast as static pages.
You can enable Static Exports on Next.js to get a static build output.
Webpack resolves import namespace before your import aliases in tsconfig.json. When using Hanzo Docs MDX, you have to rename your import alias to collections/* instead.
{
"compilerOptions": {
"paths": {
"collections/*": [".source/*"]
}
}
}Make sure to update the references as well.
import { docs } from '@hanzo/docs-mdx:collections/server';
import { docs } from 'collections/server';Same as managing layouts in Next.js App Router, remove the original MDX file from content directory (/content/docs).
This ensures duplicated pages will not cause errors.
Now, You can add the page to another route group, which isn't a descendant of docs layout.
For example, to replace /docs/test:
For /docs, you need to change the catch-all route to be non-optional:
Learn More
New to here? Don't worry, we are welcome for your questions.
If you find anything confusing, please give your feedback on Github Discussion!
Writing Content
For authoring docs, make sure to read:
Markdown
Fumadocs has some additional features for authoring content.
Navigation
Learn how to customise navigation structure.
Page Slugs & Page Tree
Learn how to organise content.
Components
See all available components to enhance your docs
Special Needs
How is this guide?
Last updated on
