Skip to main content

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:
This single 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
See the Cloudflare Workers guide for detailed deployment instructions.

Production Build

Before deploying to any platform, create a production build:
Or use the vinext CLI directly:

Build Output

vinext generates different build outputs based on your router type:

App Router Build

Multi-environment build with three separate bundles:
The RSC entry handles routing, the SSR entry renders HTML, and the client bundle provides hydration and interactivity.

Pages Router Build

Deployment Targets

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
See Cloudflare Workers Deployment for complete instructions.

Static Export

Generate a fully static site that can be deployed to any static hosting provider:
Then build:
This produces a dist/ directory with static HTML, CSS, and JavaScript files. Deploy to:
  • Cloudflare Pages
  • Vercel
  • Netlify
  • GitHub Pages
  • AWS S3 + CloudFront
  • Any static file server
Limitations:
  • No server-side rendering (SSR)
  • No API routes
  • No dynamic routes without generateStaticParams() (App Router) or getStaticPaths() (Pages Router)
  • No ISR
See Static Export Guide for details.

Node.js Server

Run a production Node.js server locally or in a container:
This starts a production server with:
  • SSR (Server-Side Rendering)
  • API routes (Pages Router) / Route handlers (App Router)
  • Middleware
  • Response compression (gzip/brotli)
Use Cases:
  • Testing production builds locally
  • Deploying to VM-based hosts
  • Docker containers
  • Traditional Node.js hosting
Options:
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
Typical savings: 20-30% smaller gzipped bundles.

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
See benchmarks.vinext.workers.dev for detailed metrics.

Code Splitting

Vite automatically code-splits:
  • Per-route chunks (lazy loaded)
  • Shared dependency extraction
  • CSS code splitting
  • Dynamic imports
No configuration needed—it works out of the box.

Health Checks

Add a health check endpoint for monitoring:

App Router

Pages Router

Rollback Strategy

Cloudflare Workers deployments support instant rollback:
For other platforms, maintain multiple deployment slots or use your hosting provider’s rollback features.

Monitoring

Cloudflare Analytics

Workers deployments include built-in analytics:
  • Request volume and errors
  • CPU time per request
  • Edge response times
  • Geographic distribution
Access via the Cloudflare Dashboard.

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:
Generate tokens at: https://dash.cloudflare.com/profile/api-tokens

Large Bundle Sizes

Problem: Client bundle is larger than expected Solution: Analyze the bundle:
Add to 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