Skip to content

Frontend deployment

Static Vue build on Cloudflare Pages. No server, no cookies, no server-side rendering.

Pre-flight

Before wiring CI, confirm in a local build:

  • bun run build (not bun run build:curation — that's a 5MB curator-only tool build that bundles pdf.js and talks to the loopback-only Curation API; it must never ship publicly).
  • Output directory is dist/ (Vite default).
  • VITE_APP_API_URL is read in src/resources/HttpRequest.ts as the axios baseURL — it has to point at the deployed API's public hostname, not localhost.

Cloudflare Pages project

  1. Cloudflare dashboard → Workers & Pages → create a Pages project, chem-assistant-frontend, connected to redcats002/chem-assistant-frontend (or left disconnected from Git and deployed only via wrangler pages deploy, which is what the CI workflow does — either works, but don't do both, or you get two competing deploy paths).
  2. Add a custom domain: app.chemassist-occ.com.
  3. Set the repo variable (not secret — it's inlined at build time, and it's not sensitive) VITE_APP_API_URL=https://api.chemassist-occ.com in the frontend repo's Settings → Secrets and variables → Actions → Variables tab.
  4. Add secrets CF_API_TOKEN (a token scoped to Cloudflare Pages — Edit) and CF_ACCOUNT_ID.

CI/CD

.github/workflows/deploy.yml: push:main and pull_request (PRs get a preview deploy). linttestbuild (with VITE_APP_API_URL baked in) → wrangler pages deploy dist. Uses the raw wrangler CLI rather than cloudflare/wrangler-action, deliberately — the action swallows wrangler's stderr, which hides the real reason a deploy failed.

PR previews

A PR push deploys to <branch>.chem-assistant-frontend.pages.dev. Since there's no auth cookie to worry about, previews can call the real production API if CORS_ORIGIN on the API allows *.pages.dev — or keep it strict to app.chemassist-occ.com and treat previews as visual-only. Pick one and set CORS_ORIGIN accordingly; it isn't decided by this page.

Rollback

Cloudflare Pages keeps every deployment. Dashboard → the project → Deployments → pick a prior one → "Rollback to this deployment". No CI involvement needed.