How facebook/docusaurus works
Project type and purpose
• This is a monorepo for Docusaurus, a static‐site generator and framework for building documentation and blog websites.
• It provides a CLI (packages/docusaurus/bin), a core orchestrator (@docusaurus/core), a plugin system (dozens of packages/docusaurus-plugin-*), themes (packages/docusaurus-theme-*), loaders (e.g. MDX loader), a bundler module (@docusaurus-bundler), and an SSG executor.
File structure
• Top level:
• packages/ – all core packages (core engine, plugins, themes, babel preset, bundler, etc.)
• examples/ – sample sites
• website/ – the Docusaurus website built with the framework itself
• Build tools & config files (lerna.json, jest.config.mjs, .github/workflows, etc.)
• Patterns:
• Monorepo (Lerna) with independent packages that plugin into the core
• Plugin architecture: each plugin exposes lifecycle hooks that the core invokes
• Loader pipeline: MDX → Remark transforms → Babel → Webpack loaders → Bundler
README for additional insights
• Highlights: CLI for creating a site, customizable plugin/theme system, i18n built-in, uses React under the hood, outputs static HTML + client bundles.