Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/facebook/docusaurus/llms.txt

Use this file to discover all available pages before exploring further.

Docusaurus is a set of npm packages that generate a full-featured documentation website from Markdown and MDX files. This page walks you through installing the prerequisites, creating a new project with the create-docusaurus scaffolding tool, exploring the generated file structure, and running the site locally and in production.
1

Check Node.js version

Docusaurus requires Node.js 24.14 or later. Verify your version before proceeding:
node -v
If the output is below v24.14, install or upgrade Node.js from nodejs.org. If you manage multiple Node.js versions, nvm makes switching straightforward.
2

Scaffold a new site

Use the create-docusaurus CLI to generate a complete starter project. The classic template is recommended — it bundles the @docusaurus/preset-classic preset, which includes docs, a blog, custom pages, and a CSS framework with dark mode.
npx create-docusaurus@latest my-website classic
To use TypeScript instead of JavaScript, append the --typescript flag:
npx create-docusaurus@latest my-website classic --typescript
The CLI detects your package manager automatically. If it cannot determine one, it will prompt you to choose between npm, yarn, pnpm, and bun.
3

Explore the generated project

After scaffolding, your project directory looks like this:
my-website
├── blog
│   ├── 2019-05-28-hola.mdx
│   ├── 2019-05-29-hello-world.mdx
│   └── 2020-05-30-welcome.mdx
├── docs
│   ├── doc1.mdx
│   ├── doc2.mdx
│   ├── doc3.mdx
│   └── mdx.mdx
├── src
│   ├── css
│   │   └── custom.css
│   └── pages
│       ├── styles.module.css
│       └── index.js
├── static
│   └── img
├── docusaurus.config.js
├── package.json
├── README.md
├── sidebars.js
└── yarn.lock
Contains the Markdown and MDX source files for your documentation. The sidebar order is controlled by sidebars.js. You can rename this directory by setting the path option in your docs plugin config.
4

Start the development server

The development server watches for file changes and reloads the browser automatically.
cd my-website
npm run start
The site opens at http://localhost:3000 by default. Edit any file in docs/, blog/, or src/ and the browser will reflect the change instantly.
5

Build for production

When you are ready to publish, generate the optimized static output:
npm run build
The compiled site is written to the build/ directory. You can preview it locally before deploying:
npm run serve
npm run serve starts a local HTTP server against the build/ directory and is the most accurate way to test the production output before pushing to a host.

Monorepo setup

If Docusaurus is part of a larger monorepo alongside the packages it documents, scaffold the site into a subdirectory:
my-monorepo
├── package-a        # Your main project source
│   └── package.json
├── website          # Docusaurus root
│   ├── docs/
│   ├── src/
│   └── package.json
└── package.json     # Shared monorepo dependencies
Run npx create-docusaurus@latest from the monorepo root and specify website as the site name. On hosting platforms like Netlify or Vercel, set the base directory to ./website so the platform resolves the correct root for builds.

Updating Docusaurus

To upgrade, update the version of every @docusaurus/-namespaced package in your package.json to the same target version, then reinstall:
npm install
Confirm the upgrade succeeded:
npx docusaurus --version

Build docs developers (and LLMs) love