vinext reimplements the Next.js module API surface using Vite, allowing you to use standardDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/cloudflare/vinext/llms.txt
Use this file to discover all available pages before exploring further.
next/* imports with full compatibility.
Available Modules
Allnext/* imports are automatically shimmed by vinext:
| Module | Description | Router Support |
|---|---|---|
| next/link | Client-side navigation with prefetching | App + Pages |
| next/image | Optimized image component | App + Pages |
| next/navigation | App Router navigation hooks | App Router |
| next/router | Pages Router navigation | Pages Router |
| next/server | Server-side request/response utilities | App + Pages |
| next/headers | Server Component header access | App Router |
| next/cache | Caching and revalidation | App Router |
| next/dynamic | Code splitting and lazy loading | App + Pages |
| next/script | Third-party script loading | App + Pages |
| next/font | Google and local font optimization | App + Pages |
How It Works
vinext’s Vite plugin interceptsnext/* imports and resolves them to shim implementations:
- Vite’s module system (ESM, HMR, multi-environment builds)
- Standard Web APIs (Request, Response, Headers)
- Multiple runtimes (Node.js, Cloudflare Workers, Deno)
Compatibility Notes
Full Compatibility
Most Next.js APIs work identically:- All navigation APIs (
useRouter,usePathname,Link) - Server Components APIs (
headers,cookies,notFound) - Middleware (
NextRequest,NextResponse) - Image optimization and lazy loading
- Font optimization (Google Fonts and local)
Runtime Differences
AsyncLocalStorage Availability
AsyncLocalStorage Availability
vinext uses
AsyncLocalStorage for request context isolation. This works in:- Node.js 16+ (native)
- Cloudflare Workers (via polyfill)
- Deno (native)
Image Optimization
Image Optimization
Local image optimization routes through
/_vinext/image:- Dev mode: Serves original files
- Cloudflare Workers: Uses Cloudflare Images binding
- Custom backends: Implement your own handler
@unpic/react for CDN-native transforms.Font Loading
Font Loading
Google Fonts:
- Dev: Loads from Google Fonts CDN
- Production: Self-hosted via build-time fetch (no runtime requests)
Extension Points
Custom Cache Handler
Swap the cache backend for Redis, DynamoDB, etc:Image Optimization Handler
Intercept/_vinext/image requests in your server:
Middleware Context
Access platform-specific context in middleware:Type Safety
All shims are fully typed with TypeScript:@types/react and the Next.js type definitions.