Skip to content

Cloudflare Pages — handover docs site

Deploy the developer handover documentation (docs/) separately from the Frappe app. This page does not describe hosting ERPNext.

Production URL: https://leekimdocs.pages.dev · Cloudflare Pages project leekimdocs.

  • Node.js 22.12+ (Astro 6 requires >=22.12.0; see docs/package.json engines and docs/.nvmrc).
  • Cloudflare account; optional Wrangler CLI (npm install already includes wrangler under docs/ devDependencies).

This environment variable feeds Astro’s site option at build time. It is used for sitemaps, canonical URLs, and any metadata that needs an absolute public URL for this handover site.

QuestionAnswer
What value?The URL users type to open this docs site: production is https://leekimdocs.pages.dev. If you attach a custom domain, use that instead (e.g. https://docs.example.com).
FormatInclude https://. Do not add a trailing /.
Local devOptional; defaults in astro.config.mjs apply if unset. For a local-only build test you can use http://localhost:4321, but CI and Cloudflare builds should use the real production URL.
Where to setRoot or docs/ .env (see .env.example), GitHub Actions repository Variable PUBLIC_SITE_URL, and/or Cloudflare Pages → project → Environment variables for dashboard builds.

If PUBLIC_SITE_URL is missing in CI, the build still uses the default in docs/astro.config.mjs (https://leekimdocs.pages.dev unless you change it).

  1. Workers & PagesCreatePagesConnect to Git.

  2. Select this repository.

  3. Configure builds:

    FieldValue
    Root directorydocs
    Build commandnpm run build
    Build output directorydist/client (not dist — static files live here with @astrojs/cloudflare)
  4. Environment variables (production / preview): set PUBLIC_SITE_URL to https://leekimdocs.pages.dev (or your custom domain; no trailing slash). Used by Astro for sitemaps and canonical URLs.

  5. Production branch: In the dashboard this lives under SettingsGeneral (not always under a separate “Builds & deployments” heading — Cloudflare’s UI changes). Set Production branch to the branch that should power https://leekimdocs.pages.dev. If docs only build from staging but production is main, Git builds show as Preview only and the project URL stays empty until a Production deployment exists. Either set production branch to staging, or merge docs to main so that branch gets a production build.

  6. Build command / output / root directory: If you use Connect to Git, these are part of the linked repository’s Pages build configuration — in some accounts they appear under SettingsPages configuration (or the Deployments tab → manage build settings). Use root docs, command npm run build, output dist/client.

  7. Save and deploy.

What you should see after a correct upload: at the root of the deployment file list, index.html, 404.html, _astro/, section folders like api/, architecture/not a single top-level folder named client that contains those files. If server/ (with entry.mjs, wrangler.json) appears alongside client/, you are still publishing dist/; switch the output to dist/client only.

Workflow: .github/workflows/deploy-docs.yml

  • Runs on changes under docs/** or when the workflow file changes; workflow_dispatch allows manual runs.
  • Sets PUBLIC_SITE_URL from repository Variables (vars.PUBLIC_SITE_URL); default in astro.config.mjs is https://leekimdocs.pages.dev. Match Cloudflare Pages env if you use dashboard builds.
  • Uploads docs/dist/client as a workflow artifact for inspection.
  • Publish: cloudflare/pages-action@v1 uploads docs/dist/client (static site root) to the leekimdocs Pages project. Required repository Secrets: CLOUDFLARE_API_TOKEN, CLOUDFLARE_ACCOUNT_ID (see Cloudflare direct upload). The job uses permissions: deployments: write and gitHubToken: ${{ github.token }} for GitHub deployment status.

From repository root:

Terminal window
npm run docs:install # once
npm run docs:build # produces docs/dist
npm run docs:preview # Astro preview
npm run docs:preview:cf # after build: Wrangler Pages dev (static under dist/client)

From docs/: see docs/README.md for wrangler.toml and adapter notes.

@astrojs/cloudflare emits dist/client (static HTML, index.html, assets) and dist/server (Worker). Pages direct upload and the dashboard “output directory” must point at dist/client, not dist, so the site root serves index.html.

  • Deployment & operations — Frappe / Bench app hosting
  • Repository docs/README.md — developer-focused build reference