Configuration
Stims includes minimal Cloudflare configuration inwrangler.toml:
wrangler.toml
Dashboard Setup
Configure these settings in the Cloudflare Pages dashboard:Configure environment variables
Set these environment variables in Pages:
BUN_INSTALL_DEV=true- Install devDependenciesBUN_VERSION=1.3.8- Pin Bun version (optional,.bun-versionfile provides default)
Bun Runtime Version
The repository includes a.bun-version file that Cloudflare Pages automatically detects:
.bun-version
bun install to fail against the lockfile.
If you need to override the Bun version, set the
BUN_VERSION environment variable in your Pages project settings.Optimized Install Flow
WhenCF_PAGES=1 is detected (automatically set by Cloudflare Pages), the postinstall script may generate dist/ during the install phase. The build command detects this and skips a redundant Vite build.
This optimization reduces build time on Pages while maintaining the same output.
CLI Deployment
Deploy from your local machine or CI using these commands:Command Details
pages:deploy: Builds the site and deploys to Cloudflare Pagespages:deploy:reuse: Deploys existingdist/folder without rebuilding (useful for CI artifacts)pages:dev: Builds and serves locally with Wrangler Pages dev server
Expected Artifacts
After deployment, verify these artifacts are present:dist/with HTML entry points and hashed assets underdist/assets/dist/.vite/manifest.jsonco-located with assets- Wrangler-generated preview URL during
pages:dev - Production deployment URL after
pages:deploy(visible in command output and dashboard)
Preview Deployments
Cloudflare Pages automatically creates preview deployments for every pull request:Validation workflow
Use the preview URL to validate before merging:
- Open the Pages preview link from the PR status or Cloudflare dashboard
- Confirm all static assets load without 404s and console logs remain clean
- Smoke-test representative HTML entry points
Test multiple entry points
Validate each HTML entry point on the preview:
index.html- Homepagetoy.html- Toy viewer- Individual toys (e.g.,
/legible.html,/multi.html,/symph.html)
Caching Configuration
Cloudflare Pages reads caching rules frompublic/_headers, which Vite copies to dist/_headers at build time.
The repository includes default caching rules:
_headers
Long-term caching is enabled for hashed assets in
/assets/*, while HTML and Vite metadata force revalidation for faster updates.Troubleshooting
Build Fails with Bun Version Mismatch
If the build fails due to Bun version issues:- Verify
.bun-versionfile exists in the repository root - Set
BUN_VERSION=1.3.8environment variable in Pages settings - Clear build cache and retry
DevDependencies Not Installed
If Vite is missing during build:- Verify install command is
bun install(notbun install --frozen-lockfile) - Set
BUN_INSTALL_DEV=trueenvironment variable - Check that
viteis listed indevDependenciesinpackage.json
Assets Return 404
If static assets fail to load:- Verify
dist/.vite/manifest.jsonexists after build - Check that build output directory is set to
distin Pages settings - Ensure
wrangler.tomlhaspages_build_output_dir = "dist"