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 start

Default localhost Access

PurposeAddress
Development Serverhttp://localhost:3000
Preview Production Buildhttp://localhost:3000 (npm run serve)

To change the port: npm start -- --port 3001.

Common Commands

CommandDescription
npm startDevelopment mode with hot reloading
npm run buildGenerate static site in build/
npm run servePreview the build results locally
npm run clearClear the cache

Content Organization

  • Documentation is placed in the docs/ directory, and blogs in the blog/
  • 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.

访客计数:------ Best viewed in Netscape Navigator · 800×600 © LocalHost Run