deploying-docs
sidebar_position: 7 title: Deploying Docs (Cloudflare Pages)
Deploying the Documentation Site
The CakeMarket documentation (Docusaurus) is bundled into the main Next.js app and served under /docs on the same Cloudflare Worker. There is no separate deployment — docs are built as static files and copied into public/docs/ before the Next.js build.
How It Works
npm run build:docsbuilds the Docusaurus site withbaseUrl: /docs/- The built output is copied from
docs/build/topublic/docs/ - Next.js picks up
public/docs/as static assets - The OpenNext/Cloudflare build bundles them into
.open-next/assets - The
cakemarketdevworker serves everything — app and docs — from one deployment
Build Commands
| Command | Description |
|---|---|
npm run build:docs | Build docs only (into public/docs/) |
npm run build | Build docs + Next.js app |
npm run deploy | Build docs + Next.js + deploy to Cloudflare |
npm run preview | Build docs + Next.js + local preview |
Local Development
To work on docs locally:
cd docs
npm install
npm start
This starts the Docusaurus dev server at http://localhost:3000/docs/.
Configuration
Key files:
docs/
├── docusaurus.config.ts # baseUrl: /docs/, url: cakemarket.app
├── sidebars.ts # Sidebar navigation structure
├── docs/ # Markdown content
│ ├── user-guides/ # Buyer, seller, admin guides
│ ├── tech/ # Technical documentation
│ └── legal/ # Legal documents, one folder per country
│ ├── poland/ # PL: ToS, privacy, cookies, seller agreement
│ └── hungary/ # HU: legal overview (full docs in preparation)
├── src/css/custom.css # Custom styles
├── static/ # Static assets (images, icons)
└── package.json # Dependencies
The public/docs/ directory is gitignored — it is generated at build time.
Updating the Docs
- Edit markdown files in
docs/docs/ - Test locally:
cd docs && npm start - Commit and push — the next deploy will include the updated docs
Troubleshooting
Build fails with broken links
Docusaurus is configured with onBrokenLinks: 'throw'. Fix any broken internal links before pushing. Run cd docs && npm run build locally to check.
Static assets not loading
Ensure static files are in docs/static/ and referenced with paths relative to the docs base URL (e.g., /docs/img/screenshot.png in production).