Deployment Guide
vinext applications can be deployed to multiple environments. Cloudflare Workers is the primary target with first-class support, but other platforms are also possible.Quick Deploy to Cloudflare Workers
The fastest way to deploy is using the built-in deploy command:- Detects your router type (App Router or Pages Router)
- Auto-generates missing configuration files
- Installs required dependencies
- Runs the production build
- Deploys to Cloudflare Workers
Production Build
Before deploying to any platform, create a production build:Build Output
vinext generates different build outputs based on your router type:App Router Build
Multi-environment build with three separate bundles:Pages Router Build
Deployment Targets
Cloudflare Workers (Recommended)
Cloudflare Workers is the primary deployment target with full feature support: ✅ Zero cold starts - Workers run globally with instant startup✅ Edge computing - Deploy to 300+ cities worldwide
✅ ISR via KV - Built-in cache handler for incremental static regeneration
✅ Image optimization - Native Cloudflare Images integration
✅ One-command deploy -
vinext deploy handles everything
Supported Features:
- App Router with React Server Components
- Pages Router with SSR and API routes
- Middleware and rewrites
- Server Actions
- ISR (Incremental Static Regeneration)
- Streaming SSR
- Image optimization via Cloudflare Images
Static Export
Generate a fully static site that can be deployed to any static hosting provider:dist/ directory with static HTML, CSS, and JavaScript files. Deploy to:
- Cloudflare Pages
- Vercel
- Netlify
- GitHub Pages
- AWS S3 + CloudFront
- Any static file server
- No server-side rendering (SSR)
- No API routes
- No dynamic routes without
generateStaticParams()(App Router) orgetStaticPaths()(Pages Router) - No ISR
Node.js Server
Run a production Node.js server locally or in a container:- SSR (Server-Side Rendering)
- API routes (Pages Router) / Route handlers (App Router)
- Middleware
- Response compression (gzip/brotli)
- Testing production builds locally
- Deploying to VM-based hosts
- Docker containers
- Traditional Node.js hosting
The Node.js production server is less optimized than Cloudflare Workers deployment. Workers is the recommended production target.
Custom Deployment
For other platforms, you can import the production build programmatically:App Router
Pages Router
Environment-Specific Configuration
Use different configs for different environments:Development
Production (Cloudflare Workers)
Conditional Config
CI/CD Integration
GitHub Actions (Cloudflare Workers)
GitHub Actions (Static Export)
Performance Optimization
Bundle Size
vinext produces smaller client bundles than Next.js due to:- More aggressive tree-shaking (Vite/Rollup)
- Lighter client-side router
- Minimal framework overhead
Build Speed
Benchmarks show vinext builds are significantly faster than Next.js:- Development cold start: ~2-3x faster
- Production build: ~1.5-2x faster
- HMR updates: Near-instant
Code Splitting
Vite automatically code-splits:- Per-route chunks (lazy loaded)
- Shared dependency extraction
- CSS code splitting
- Dynamic imports
Health Checks
Add a health check endpoint for monitoring:App Router
Pages Router
Rollback Strategy
Cloudflare Workers deployments support instant rollback:Monitoring
Cloudflare Analytics
Workers deployments include built-in analytics:- Request volume and errors
- CPU time per request
- Edge response times
- Geographic distribution
Custom Logging
Troubleshooting
Build Failures
Error:Cannot find module during build
Solution: Ensure all dependencies are installed:
Memory Issues
Error: JavaScript heap out of memory Solution: Increase Node.js memory limit:Deploy Failures (Cloudflare)
Error:Authentication error during deploy
Solution: Set your Cloudflare API token:
Large Bundle Sizes
Problem: Client bundle is larger than expected Solution: Analyze the bundle:vite.config.ts:
Next Steps
Cloudflare Workers
Complete guide to deploying on Cloudflare Workers
Static Export
Generate static HTML for any hosting provider
Configuration
Advanced configuration options
Build Pipeline
Build optimization and performance