Hosting this site
This documentation site is an Astro Starlight project in apps/docs. It is private to this repository and is never published to npm.
| Site | Address | Source | Workflow |
|---|---|---|---|
| Documentation | https://lumen-charts.studiocyf.app |
apps/docs |
.github/workflows/docs.yml |
Build locally
Section titled “Build locally”pnpm docs:dev # http://localhost:4321pnpm docs:build # writes apps/docs/distpnpm docs:preview # preview the built static site locallypnpm docs:test # run generator and build output checksBefore dev or build runs, apps/docs/scripts/generate.ts writes the pages whose source of truth lives elsewhere in the repository so documentation cannot drift:
| Pages | Source |
|---|---|
Guides (/guides/*) |
docs/guide/*.md (build fails if any guide file is unmapped) |
Releasing (/releasing/) |
docs/releasing.md |
Reference (/reference/*) |
packages/core/src/* and packages/engine/src/* |
The build also produces:
/llms.txt,/llms-full.txt, and/llms-small.txtviastarlight-llms-txt- A plain-Markdown copy of every English page with
.mdreplacing the trailing slash (for example,/guides/indicators.mdand/reference/palettes-and-themes.md) - Preloaded inline
srcdocframes (apps/docs/scripts/demo-frames.ts) for every live chart demo so frames start loading alongside the host page instead of waiting on an extra round trip
Deploy to Cloudflare Workers
Section titled “Deploy to Cloudflare Workers”apps/docs/wrangler.jsonc deploys apps/docs/dist to Cloudflare Workers as static assets. Because no Worker script runs, asset requests do not count against the Workers free plan’s daily request limit.
To deploy manually from your machine, build first (setting DOCS_SITE), then run the deploy script using your wrangler login session:
DOCS_SITE=https://lumen-charts.studiocyf.app pnpm docs:buildpnpm deploy:docsThe GitHub Actions workflow in .github/workflows/docs.yml does not deploy automatically until you configure it:
- Create a Cloudflare API token as described in The API token.
- In the GitHub repository settings, create an environment named
cloudflare. Restrict its deployment branches tomainonly. Add the token as the environment secretCLOUDFLARE_API_TOKENand your Cloudflare account ID as the environment secretCLOUDFLARE_ACCOUNT_ID. Use environment secrets — not repository secrets — so only runs onmaincan read them. - Optionally set the repository variable
DOCS_SITEto your site’s public address (defaults tohttps://lumen-charts.studiocyf.app). Canonical links, the sitemap, andllms.txtare generated from this value. - Run the Docs workflow manually once from the Actions tab (
workflow_dispatch) to verify the deployment. - To deploy automatically on every push to
mainthat touches docs or library sources, set the repository variableDOCS_DEPLOYtotrue.
The API token
Section titled “The API token”Cloudflare cannot scope a token to a single Worker. Give the token only the permissions required for static-asset deployment and custom-domain routing:
| Scope | Permission | Resources |
|---|---|---|
| Account | Workers Scripts: Edit | Only the account that holds the site |
| Zone | Workers Routes: Edit | Only the zone of studiocyf.app (or your own domain) |
Avoid the broad “Edit Cloudflare Workers” template, which also grants KV, R2, and Pages permissions this deployment never uses. Set an expiration date and rotate the token before it expires.
How the workflow protects the token
Section titled “How the workflow protects the token”This repository is public, so .github/workflows/docs.yml assumes anyone can read it and open a pull request:
- No deploy on pull requests. The workflow triggers only on
workflow_dispatchand pushes tomain. Fork pull requests never see any secret. - Branch-restricted environment. Secrets live in the
cloudflareenvironment, restricted tomain. - Split build and deploy jobs. The
buildjob runs Astro, Vite, and workspace code with zero secrets and uploadsapps/docs/distas an artifact. Thedeployjob holds the Cloudflare credentials and runs only Wrangler on the uploaded artifact. - Lockfile-pinned Wrangler without install scripts or shared cache. Wrangler is isolated in
tools/deploy(@lumen-charts/deploy), pinned to an exact version inpnpm-lock.yaml, withesbuildandworkerdinstall scripts disabled inpnpm-workspace.yaml. The deploy job installs it with--frozen-lockfile --ignore-scripts --filter @lumen-charts/deployand disables tool/pnpm caching so untrusted build-job caches can never cross into the deploy job. - Commit-pinned actions. Every GitHub Action in
docs.ymlis pinned to a full commit SHA, updated monthly with a 14-day cooldown via.github/dependabot.yml. - No account ID in git.
wrangler.jsoncintentionally omitsaccount_id; Wrangler readsCLOUDFLARE_ACCOUNT_IDfrom the environment.
Never commit .wrangler/ or .dev.vars — both are listed in .gitignore.
Use a domain of your own
Section titled “Use a domain of your own”apps/docs/wrangler.jsonc attaches the Worker to lumen-charts.studiocyf.app as a Workers Custom Domain (custom_domain: true). On deploy, Cloudflare provisions the DNS record and TLS certificate automatically:
- The domain’s zone must exist in the same Cloudflare account, and the hostname must not already have a manual CNAME record.
workers_devandpreview_urlsare explicitly set tofalseso the site is served solely from its custom domain and never exposed on a*.workers.devsubdomain.
In a fork, replace pattern in apps/docs/wrangler.jsonc with your own hostname and set the DOCS_SITE repository variable to match. To deploy to a workers.dev subdomain instead, remove routes and set workers_dev to true.
GitHub Pages alternative
Section titled “GitHub Pages alternative”You can also host the built apps/docs/dist folder on GitHub Pages without Cloudflare DNS: build with DOCS_SITE=https://<your-domain> pnpm docs:build, upload apps/docs/dist using actions/upload-pages-artifact, and deploy via actions/deploy-pages. Note that GitHub Pages ignores public/_headers, so immutable cache headers for /_astro/* and explicit text/markdown headers for /*.md only apply on Cloudflare Workers.