- Step-based flow: Choose action → Choose method → Enter details → Chat - Modern design with clean header and footer - GitHub links with icons to client and server repos - Footer link to ronde.vu - Three connection methods: Topic, Peer ID, Connection ID - Real WebRTC peer-to-peer chat - Mobile-responsive design - Collapsible activity log 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
5.9 KiB
Deploying Rondevu Demo to Cloudflare Pages
This guide covers deploying the Rondevu demo to Cloudflare Pages.
Prerequisites
- Cloudflare account (free tier works)
- Node.js 18+ installed locally
- Git repository (for automatic deployments)
Option 1: Deploy via Git Integration (Recommended)
This is the easiest method with automatic deployments on every push.
Step 1: Push to Git
If you haven't already, initialize a git repository:
cd demo
git init
git add .
git commit -m "Initial commit: Rondevu demo"
git remote add origin https://github.com/YOUR_USERNAME/rondevu-demo.git
git push -u origin main
Step 2: Connect to Cloudflare Pages
- Go to Cloudflare Dashboard
- Navigate to Pages in the sidebar
- Click Create a project
- Click Connect to Git
- Authorize Cloudflare to access your GitHub/GitLab account
- Select your
rondevu-demorepository
Step 3: Configure Build Settings
Use these settings:
- Project name:
rondevu-demo(or your preferred name) - Production branch:
main - Framework preset:
Vite - Build command:
npm run build - Build output directory:
dist - Root directory:
/(or leave empty) - Node version:
18(or higher)
Step 4: Deploy
- Click Save and Deploy
- Cloudflare will build and deploy your site
- You'll get a URL like:
https://rondevu-demo.pages.dev
Automatic Deployments
Every push to main will trigger a new deployment automatically!
Option 2: Deploy via Wrangler CLI
Deploy directly from your local machine using Wrangler.
Step 1: Install Wrangler
npm install -g wrangler
Or use without installing:
npx wrangler
Step 2: Login to Cloudflare
wrangler login
This will open your browser to authenticate.
Step 3: Build Your Project
npm run build
This creates the dist/ directory with your static files.
Step 4: Deploy to Cloudflare Pages
wrangler pages deploy dist --project-name=rondevu-demo
Or if you prefer, use the simpler command:
npx wrangler pages deploy dist
Wrangler will:
- Create the Pages project if it doesn't exist
- Upload all files from
dist/ - Deploy to production
Step 5: Access Your Site
After deployment, you'll see output like:
✨ Deployment complete! Take a peek over at https://rondevu-demo.pages.dev
Option 3: Deploy via Dashboard Upload
For quick testing without Git or CLI.
Step 1: Build Locally
npm run build
Step 2: Create a ZIP
cd dist
zip -r ../demo.zip .
cd ..
Step 3: Upload to Cloudflare
- Go to Cloudflare Pages
- Click Create a project
- Click Direct Upload
- Drag and drop your
demo.zipfile - Wait for deployment
Custom Domain (Optional)
Add a Custom Domain
- Go to your Pages project in the Cloudflare dashboard
- Click Custom domains
- Click Set up a custom domain
- Enter your domain (e.g.,
demo.rondevu.dev) - Follow the DNS instructions
- Cloudflare will automatically provision an SSL certificate
Environment Variables
The demo doesn't require any environment variables since the server URL is hardcoded. However, if you want to make it configurable:
Step 1: Update vite.config.js
import { defineConfig } from 'vite';
export default defineConfig({
define: {
'import.meta.env.VITE_RONDEVU_URL': JSON.stringify(
process.env.VITE_RONDEVU_URL || 'https://rondevu.xtrdev.workers.dev'
)
},
// ... rest of config
});
Step 2: Update src/main.js
const client = new RondevuClient({
baseUrl: import.meta.env.VITE_RONDEVU_URL || 'https://rondevu.xtrdev.workers.dev'
});
Step 3: Set Environment Variables in Cloudflare
In your Pages project settings:
- Go to Settings → Environment variables
- Add:
VITE_RONDEVU_URL=https://your-server.workers.dev - Redeploy
Troubleshooting
Build Fails
Issue: Build command fails with module errors
Solution: Ensure package.json and package-lock.json are committed to your repository.
Wrong Node Version
Issue: Build uses wrong Node.js version
Solution: Add .node-version file (already created) or set in Pages settings.
404 Errors
Issue: Page shows 404 when deployed
Solution: Ensure build output directory is set to dist in Pages settings.
CORS Errors
Issue: API requests fail with CORS errors
Solution: Ensure your Rondevu server has CORS properly configured (already fixed in latest version).
Updating Your Deployment
Git Integration Method
git add .
git commit -m "Update demo"
git push
Cloudflare Pages will automatically deploy the update.
Wrangler CLI Method
npm run build
wrangler pages deploy dist --project-name=rondevu-demo
Monitoring and Analytics
Cloudflare Pages provides:
- Analytics: View page views and requests
- Real-time logs: Monitor deployments
- Build history: View all deployments and rollback if needed
Access these in your Pages project dashboard.
Cost
Cloudflare Pages is free for:
- Unlimited static requests
- Unlimited bandwidth
- 500 builds per month
- 1 concurrent build
Perfect for this demo! 🎉
Advanced: Branch Previews
Cloudflare automatically creates preview deployments for all branches:
- Create a new branch:
git checkout -b new-feature - Make changes and push:
git push origin new-feature - Cloudflare creates a preview URL:
https://new-feature.rondevu-demo.pages.dev - Test your changes before merging to main
Next Steps
After deploying:
- Test the demo at your Pages URL
- Share the link with others to test P2P connections
- Add a custom domain for a professional look
- Monitor usage in the Cloudflare dashboard
Happy deploying! 🚀