Deployment
Deploy to Cloudflare Workers and Pages
Overview
EasyStarter is optimized for deployment on Cloudflare:
- Web: Cloudflare Pages
- Server: Cloudflare Workers
Prerequisites
- Cloudflare account
- Wrangler CLI configured
- D1 database created
Quick Deploy
# Deploy both web and server
pnpm run deploy
# Deploy individually
pnpm deploy:web
pnpm deploy:serverFirst Deployment
1. Initial Deploy
pnpm run deployThis will output your production URLs:
- Web:
https://your-app.pages.dev - Server:
https://your-api.workers.dev
2. Update Configuration
Server (apps/server/wrangler.jsonc):
{
"vars": {
"WEBSITE_URL": "https://your-app.pages.dev",
"SERVER_URL": "https://your-api.workers.dev",
},
}Web (apps/web/.env.production):
VITE_SERVER_URL=https://your-api.workers.dev
VITE_APP_URL=https://your-app.pages.dev3. Redeploy
pnpm run deployEnvironment Variables
Server Secrets
Set secrets using Wrangler:
cd apps/server
# Authentication
npx wrangler secret put AUTH_SECRET
# OAuth
npx wrangler secret put GITHUB_CLIENT_ID
npx wrangler secret put GITHUB_CLIENT_SECRET
npx wrangler secret put GOOGLE_CLIENT_ID
npx wrangler secret put GOOGLE_CLIENT_SECRET
# Email
npx wrangler secret put RESEND_API_KEYDatabase Migration
Run migrations on production D1:
cd apps/server
pnpm db:migrate --remoteCustom Domain
- Go to Cloudflare Dashboard → Pages → your project
- Navigate to "Custom domains"
- Add your domain
- Update DNS records as instructed
Troubleshooting
| Issue | Solution |
|---|---|
| CORS errors | Check WEBSITE_URL in server config |
| Auth not working | Verify AUTH_SECRET is set |
| Database errors | Run db:migrate --remote |