This document describes:
- the current static build behavior of the repo,
- the deployment target we are actually moving toward next,
- the CI/CD contract expected for Cloudflare Pages.
Today, the repository supports local production builds through Vite:
npm ci
npm run buildCurrent facts:
- the build outputs static assets to
dist/, - Vite copies
public/model/*intodist/model/*, - the runtime loads the model from
/model/model.json, - there is not yet a committed GitHub Actions deploy workflow for production.
The intended deployment target is:
- Cloudflare Pages
- deployed through GitHub Actions
- using Wrangler direct upload from CI
This replaces the older GitHub Pages plan and matches the current task plan for Phase 3.
The current app expects a root-served model path:
/model/model.jsonThat makes Cloudflare Pages a better fit for the current setup than a repository-subpath deployment model, because it avoids introducing extra base-path complexity into the browser model URL.
The CI build step must run:
npm ci
npm run buildExpected output:
dist/index.html- compiled frontend assets under
dist/assets/ - copied model assets under
dist/model/
Required validation:
dist/exists after build,dist/model/model.jsonexists,dist/model/group1-shard1of1.binexists.
The planned workflow should:
- trigger on push to
main, - optionally support
workflow_dispatch, - check out the repository,
- set up Node.js,
- run
npm ci, - run
npm run build, - deploy
dist/to Cloudflare Pages with Wrangler.
CLOUDFLARE_API_TOKENCLOUDFLARE_ACCOUNT_ID
CLOUDFLARE_PROJECT_NAME
The intended deploy command is:
pages deploy dist --project-name=${{ vars.CLOUDFLARE_PROJECT_NAME }}
Expected GitHub Action integration:
cloudflare/wrangler-action@v3
name: Deploy CNN Visualizer
on:
push:
branches: [main]
workflow_dispatch:
permissions:
contents: read
deployments: write
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
- run: npm ci
- run: npm run build
- uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
command: pages deploy dist --project-name=${{ vars.CLOUDFLARE_PROJECT_NAME }}After deploy:
- the site opens without a blank screen,
/model/model.jsonresolves,- the model shard resolves,
- draw -> preprocess -> predict works,
- the deployed app behaves like the local
npm run buildresult.
If deployment fails:
- inspect the GitHub Actions run,
- verify Cloudflare credentials and project name,
- confirm the
dist/modelfiles were generated, - rerun the workflow or redeploy the last known good commit.
- Missing or invalid Cloudflare secrets.
- Wrong Pages project name.
dist/modelmissing the committed TF.js artifacts.- Hosting path drift that breaks
/model/model.json. - Build passing locally but failing in CI because of lockfile drift.
Phase 3 deployment work is complete when:
- the workflow exists in
.github/workflows/, - a push to
maindeploys successfully, - Cloudflare serves the app and model assets correctly,
- the workflow can be rerun safely without manual local deploys.