Architecture
Benefits
- Faster delivery: CDN edge locations worldwide
- Lower backend load: Backend only handles APIs
- Scalability: CDN handles millions of requests
- Cost effective: CDN bandwidth cheaper than server
Setup
1. Build Frontend
2. Deploy Frontend to CDN
Vercel:3. Configure API URL
4. Deploy Backend
Deploy Mizu backend to server (DigitalOcean, AWS, etc.):CORS Configuration
Backend must allow requests from CDN:Environment Configuration
Development
Staging
Production
CDN Configuration
Vercel
Netlify
CloudFlare
Use CloudFlare Workers for API proxying.Cache Headers
CDN respects your cache headers:Deployment Workflow
Trade-offs
Pros
- ✅ Very fast global delivery
- ✅ Unlimited scalability
- ✅ Lower backend costs
- ✅ DDoS protection (CDN)
Cons
- ❌ More complex setup
- ❌ Two deployments
- ❌ CORS configuration needed
- ❌ Additional CDN costs
When to Use
Use CDN hosting when:- High traffic expected
- Global audience
- Cost optimization needed
- Want best performance
- Simple deployment preferred
- Lower traffic
- Single region
- Want version consistency