Docusaurus Local Development Guide
Build documentation and blog sites using Docusaurus, based on React and MDX, with hot reloading on the default localhost:3000.
Docusaurus is an open-source static site generator by Meta, designed specifically for technical documentation, API references, and blogs. It is based on React and supports MDX, versioned documentation, search plugins, and internationalization.
Quick Start
npx create-docusaurus@latest my-website classic
cd my-website
npm install
npm startDefault localhost Access
| Purpose | Address |
|---|---|
| Development Server | http://localhost:3000 |
| Preview Production Build | http://localhost:3000 (npm run serve) |
To change the port: npm start -- --port 3001.
Common Commands
| Command | Description |
|---|---|
npm start | Development mode with hot reloading |
npm run build | Generate static site in build/ |
npm run serve | Preview the build results locally |
npm run clear | Clear the cache |
Content Organization
- Documentation is placed in the
docs/directory, and blogs in theblog/ - Supports MDX, allowing React components to be embedded in Markdown
- Configure navigation, themes, and plugins through
docusaurus.config.js
Deployment
The build output in build/ can be deployed to static hosting services such as GitHub Pages, Cloudflare Pages, and Netlify.
Summary
Docusaurus is one of the preferred solutions for documentation sites. Local development can be accessed at http://localhost:3000, making it suitable for open-source project documentation, internal knowledge bases, and technical blogs.