Skip to main content

Docusaurus

还没翻译译自英文(developers.cloudflare.com)本页 24 段都还没译

Start from CLI: Scaffold a Docusaurus project on Workers, and pick your template.

npmyarnpnpm

npm create cloudflare@latest -- my-docusaurus-app --framework=docusaurus

Or just deploy: Create a documentation site with Docusaurus and deploy it on Cloudflare Workers, with CI/CD and previews all set up for you.

Deploy to Workers

What is Docusaurus?

Docusaurus is an open-source framework for building, deploying, and maintaining documentation websites. It is built on React and provides an intuitive way to create static websites with a focus on documentation.

Docusaurus is designed to be easy to use and customizable, making it a popular choice for developers and organizations looking to create documentation sites quickly.

Deploy a new Docusaurus project on Workers

  1. Create a new project with the create-cloudflare CLI (C3).

    npmyarnpnpm

    npm create cloudflare@latest -- my-docusaurus-app --framework=docusaurus --platform=workers

    What's happening behind the scenes?

  2. Develop locally.

    After creating your project, run the following command in your project directory to start a local development server.

    npmyarnpnpm

    npm run dev
  3. Deploy your project.

    Your project can be deployed to a *.workers.dev subdomain or a Custom Domain, from your local machine or any CI/CD system, (including Workers Builds).

    Use the following command to build and deploy your project. If you're using a CI service, be sure to update your "deploy command" accordingly.

    npmyarnpnpm

    npm run deploy

Deploy an existing Docusaurus project on Workers

If you have a static site

If your Docusaurus project is entirely pre-rendered (which it usually is), follow these steps:

  1. Add a Wrangler configuration file.

    In your project root, create a Wrangler configuration file with the following content:

    wrangler.jsoncwrangler.toml

    	{
    		"name": "my-docusaurus-app",
    		// Update to today's date
    		// Set this to today's date
    		"compatibility_date": "2026-11-02",
    		"assets": {
    			"directory": "./build"
    		}
    	}

    What's this configuration doing?

  2. Build and deploy your project.

    You can deploy your project to a *.workers.dev subdomain or a custom domain from your local machine or any CI/CD system (including Workers Builds). Use the following command to build and deploy. If you're using a CI service, be sure to update your "deploy command" accordingly.

    npmyarnpnpm

    npx docusaurus build

    npmyarnpnpm

    npx wrangler@latest deploy

Use bindings with Docusaurus

Bindings are a way to connect your Docusaurus project to other Cloudflare services, enabling you to store and retrieve data within your application.

With bindings, your application can be fully integrated with the Cloudflare Developer Platform, giving you access to compute, storage, AI and more.

Bindings

Access to compute, storage, AI and more.