Cloudflare Deployment Quick Reference

TL;DR for safe deployments

⚡ Cloudflare Deployment Quick Reference

TL;DR for future agents: Read this before deploying ANYTHING to Cloudflare.


🚨 Critical Rules

1. ALWAYS Clear Cache Before Deploy

nx reset && rm -rf dist/apps/{APP_NAME}

Why? NX caches builds aggressively. Even with code changes, it may serve old builds.

2. ALWAYS Use --skip-nx-cache

yarn nx build {APP_NAME} --configuration=production --skip-nx-cache

Why? Forces fresh compilation. Without this, you might deploy stale code.

3. ALWAYS Use Correct Branch

App Production Branch Preview Branch
docs-angular deploy/docs main
gograb-space main other branches
gograb-admin main other branches
gograb-dev main other branches
gograb-ai main other branches
space-admin main other branches

Why? Custom domains are bound to Production environment. Wrong branch = Preview only.


📋 All Deploy Commands

App Yarn Command CF Project
Main App yarn deploy:wrangler:gograb gograb-space-app
Admin yarn deploy:wrangler:admin gograb-admin-app
Dev yarn deploy:wrangler:dev gograb-dev-app
AI yarn deploy:wrangler:ai gograb-ai-app
Space Admin yarn deploy:wrangler:space-admin space-admin-app
Docs yarn deploy:docs gograb-docs
Landing yarn deploy:landing gograb-landing
Pulse yarn deploy:pulse gograb-pulse

📋 Docs-Angular Deploy Command

# Safe one-liner (recommended)
yarn deploy:docs

# Manual (if needed)
nx reset && rm -rf dist/apps/docs-angular && \
yarn nx build docs-angular --configuration=production --skip-nx-cache && \
npx wrangler pages deploy ./dist/apps/docs-angular/browser \
  --project-name=gograb-docs \
  --branch=deploy/docs \
  --commit-dirty=true

🔍 Verify Deployment

# Check which environment your deployment went to
npx wrangler pages deployment list --project-name=gograb-docs | head -5

# Compare chunk hashes (should match)
curl -s https://docs.gograb.space/ | grep -oE 'main-[A-Z0-9]+\.js' | head -1
ls dist/apps/docs-angular/browser/main-*.js | xargs basename

⚠️ Common Mistakes (Session 73)

Mistake Symptom Fix
No cache clear Local works, prod broken nx reset && rm -rf dist/
Wrong branch New URL works, custom domain broken Use --branch=deploy/docs
Old wrangler cache "0 files uploaded" Clear + rebuild + redeploy

📚 Full Documentation