Dumping ground for bunch of projects and experiences, credits to Kevin Powell for the initial website idea.
- Run
npm installfrom the root to install the required packages - Run
npm run startto start the development server - Run
npm run buildto build a production deployment
- Install dependencies:
npm install - Verify Wrangler:
npx wrangler --version - Login to Cloudflare:
npx wrangler login
- Run
npm startto start the React development server - Run
npx wrangler dev --localto start the Cloudflare Worker locally - Visit
http://localhost:8787to see your worker in action
./deploy.sh- Build the project:
npm run build - Deploy to Cloudflare Workers:
npx wrangler deploy
- Default:
npm run worker:deploy - Staging:
npm run worker:deploy:staging - Production:
npm run worker:deploy:prod
wrangler.toml- Cloudflare Workers configurationsrc/worker.js- Worker script that serves static filesdeploy.sh- Automated deployment script
- This setup uses Wrangler v3 for compatibility with Node.js v18
- The worker serves your React build files from the
./builddirectory - Make sure to run
npx wrangler loginbefore your first deployment