WorldScript Studio is a static SPA (Vite β dist/). API keys stay client-side in IndexedDB; do not put Gemini/OpenAI secrets in host environment variables for inference.
| Target | Build command | Vite base |
Typical URL |
|---|---|---|---|
| GitHub Pages (default CI) | pnpm run build |
/WorldScript-Studio/ |
https://<user>.github.io/WorldScript-Studio/ |
| Vercel | pnpm run build:edge |
/ |
https://<project>.vercel.app/ |
| Cloudflare Pages | pnpm run build:edge |
/ |
https://<project>.pages.dev/ |
Edge builds run scripts/build-edge.mjs: sets DEPLOY_TARGET=edge, patches public/manifest.json, offline.html, 404.html, then vite build.
- Repo Settings β Pages β Build and deployment: source GitHub Actions.
- Push to
main; workflow.github/workflows/ci.ymlruns build + e2e, then deploy uploadsdist/(built withpnpm run build, subpath base). - Environment github-pages must exist (created on first successful deploy).
# Pages enabled?
gh api repos/:owner/:repo/pages 2>/dev/null || echo "Pages API: not configured or billing/plan blocked"
# Latest deploy workflow
gh run list --workflow="CI / CD" --limit 3
gh run view <run-id> --log-failedBilling / availability: If the deploy job is skipped or fails with Resource not accessible, check Settings β Billing (Actions minutes, Pages for private repos). Public forks get Pages on the fork ownerβs plan. The app remains buildable locally with pnpm run build && pnpm run preview.
- Import the Git repository; Root Directory = repo root.
- Framework: Other (or Vite). Settings are overridden by
vercel.json:- Install:
pnpm install --frozen-lockfile - Build:
pnpm run build:edge - Output:
dist
- Install:
- Node.js β₯ 22 (Project Settings β General).
- Environment variables (optional):
DEPLOY_TARGET=edgeβ redundant if usingbuild:edge; do not add AI API keys for end users. - SPA routing:
rewritesinvercel.jsonβindex.html. - Preview deployments: enabled per branch/PR by default.
- Cloudflare Dashboard β Workers & Pages β Pages β Connect Git.
- Build command:
pnpm install && pnpm run build:edge - Build output directory:
dist - Deploy command: leave completely empty β Cloudflare uploads
distafter a successful build. - Do not use
npx wrangler deploy(Workers) norwrangler pages deployin the deploy step β redundant and often fails on API token scope in the build container. - If the UI forces a deploy command, use:
pnpm run deploy:cloudflareβ it exits 0 on Cloudflare (CF_PAGES=1) without calling Wrangler. - Remove
CLOUDFLARE_API_TOKENfrom Pages build environment variables unless you have a dedicated manual deploy workflow; it is not needed for Git-based Pages. - Environment variables (build):
NODE_VERSION=22,PNPM_VERSION=10(or Corepack). - Root: repository root; Package manager: pnpm.
Status: Optional GitHub workflow
.github/workflows/deploy-cloudflare-pages.ymlis paused (if: false). Prefer dashboard-only Pages deploy.
Static extras in public/:
_redirectsβ SPA fallback/* β /index.html_headersβ cache + security headers
Local preview with Wrangler (optional):
pnpm run build:edge
pnpm exec wrangler pages dev distConfig: wrangler.toml.
Workflow .github/workflows/deploy-cloudflare-pages.yml runs only when secrets are set:
| Secret | Purpose |
|---|---|
CLOUDFLARE_API_TOKEN |
Pages deploy token |
CLOUDFLARE_ACCOUNT_ID |
Account ID from dashboard |
Without secrets the job is skipped (fork-safe).
Workflow .github/workflows/deploy-cloudflare-pages.yml can run on v* tags when CLOUDFLARE_API_TOKEN and CLOUDFLARE_ACCOUNT_ID are set. Prefer dashboard Git integration for day-to-day deploys; use tags for release snapshots.
pnpm run build:edge
pnpm run deploy:cloudflare # exits 0 on CF_PAGES=1; otherwise wrangler pages deploy dist# GitHub Pages-shaped build
pnpm run build && pnpm run preview
# Vercel / Cloudflare-shaped build (root base)
pnpm run build:edge && pnpm exec vite preview --base /- No server-side storage of manuscripts or API keys.
- CSP in
index.html/ Tauritauri.conf.jsonβ extendconnect-srconly when adding new AI hosts. - Service worker: AI hosts are network-only (
public/sw.js); WASM/ONNX not precached.
Pricing / SLAs: Vendor pricing changes frequently β verify current Pages, Vercel, and Cloudflare plans before production commitments.