Docusaurus
Start from CLI: Scaffold a Docusaurus project on Workers, and pick your template.
npm create cloudflare@latest -- my-docusaurus-app --framework=docusaurusyarn create cloudflare my-docusaurus-app --framework=docusauruspnpm create cloudflare@latest my-docusaurus-app --framework=docusaurusOr just deploy: Create a documentation site with Docusaurus and deploy it on Cloudflare Workers, with CI/CD and previews all set up for you.
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.
-
Create a new project with the create-cloudflare CLI (C3).
Terminal window npm create cloudflare@latest -- my-docusaurus-app -- --framework=docusaurus --platform=workersTerminal window yarn create cloudflare my-docusaurus-app -- --framework=docusaurus --platform=workersTerminal window pnpm create cloudflare@latest my-docusaurus-app -- --framework=docusaurus --platform=workersWhat's happening behind the scenes?
When you run this command, C3 creates a new project directory, initiates Docusaurus' official setup tool ↗, and configures the project for Cloudflare. It then offers the option to instantly deploy your application to Cloudflare.
-
Develop locally.
After creating your project, run the following command in your project directory to start a local development server.
Terminal window npm run devTerminal window yarn run devTerminal window pnpm run dev -
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.
Terminal window npm run deployTerminal window yarn run deployTerminal window pnpm run deploy
If your Docusaurus project is entirely pre-rendered (which it usually is), follow these steps:
-
Add a Wrangler configuration file.
In your project root, create a Wrangler configuration file with the following content:
{"name": "my-docusaurus-app",// Update to today's date"compatibility_date": "2025-03-25","assets": {"directory": "./build"}}name = "my-docusaurus-app"compatibility_date = "2025-03-25"[assets]directory = "./build"What's this configuration doing?
The key part of this config is the
assetsfield, which tells Wrangler where to find your static assets. In this case, we're telling Wrangler to look in the./builddirectory. If your assets are in a different directory, update thedirectoryvalue accordingly. Refer to other asset configuration options.Also note how there's no
mainfield in this config - this is because you're only serving static assets, so no Worker code is needed for on demand rendering/SSR. -
Build and deploy your project.
You can deploy your project to a
*.workers.devsubdomain 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.Terminal window npx docusaurus buildTerminal window yarn docusaurus buildTerminal window pnpm docusaurus buildTerminal window npx wrangler@latest deployTerminal window yarn wrangler@latest deployTerminal window pnpm wrangler@latest deploy
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.
Was this helpful?
- Resources
- API
- New to Cloudflare?
- Directory
- Sponsorships
- Open Source
- Support
- Help Center
- System Status
- Compliance
- GDPR
- Company
- cloudflare.com
- Our team
- Careers
- © 2025 Cloudflare, Inc.
- Privacy Policy
- Terms of Use
- Report Security Issues
- Trademark