This guide covers setting up vinext for local development from source.Documentation 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.
Prerequisites
- Node.js 18 or later
- pnpm (the project uses pnpm workspaces)
- Git
Local setup from source
If you’re working from the repo instead of installing from npm:packages/vinext/dist/. For active development, use pnpm --filter vinext run dev to run tsc --watch.
Linking to an external project
To use your local vinext build against an external Next.js app, link the built package:package.json as a file dependency:
react ^19.2.4, react-dom ^19.2.4, and vite ^7.0.0. Then replace next with vinext in your scripts and run as normal.
Commands
Project Structure
Key Files
| File | Purpose | |------|---------|| |index.ts | Vite plugin — resolves next/* imports, generates virtual modules |
| shims/*.ts | Reimplementations of next/link, next/navigation, etc. |
| server/dev-server.ts | Pages Router SSR handler |
| server/app-dev-server.ts | App Router RSC entry generator |
| routing/pages-router.ts | Scans pages/ directory |
| routing/app-router.ts | Scans app/ directory |
Test Fixtures
tests/fixtures/pages-basic/— Pages Router test apptests/fixtures/app-basic/— App Router test appexamples/app-router-cloudflare/— App Router on Workersexamples/pages-router-cloudflare/— Pages Router on Workers
Examples (Ecosystem Ports)
Theexamples/ directory contains real-world Next.js apps ported to run on vinext. These are deployed to Cloudflare Workers on every push to main (see .github/workflows/deploy-examples.yml).
| Example | Type | URL |
|---------|------|-----||
| app-router-cloudflare | App Router basics | app-router-cloudflare.vinext.workers.dev |
| pages-router-cloudflare | Pages Router basics | pages-router-cloudflare.vinext.workers.dev |
| app-router-playground | Next.js playground (MDX, Tailwind) | app-router-playground.vinext.workers.dev |
| realworld-api-rest | RealWorld spec (Pages Router) | realworld-api-rest.vinext.workers.dev |
| nextra-docs-template | Nextra docs site (MDX, App Router) | nextra-docs-template.vinext.workers.dev |
| benchmarks | Performance benchmarks | benchmarks.vinext.workers.dev |
| hackernews | HN clone (App Router, RSC) | hackernews.vinext.workers.dev |
Git Workflow
Branch protection is enabled on main. Required checks: Lint, Typecheck, Vitest, Playwright E2E. Pushing directly to main bypasses these protections and can introduce regressions.PR workflow
- Create a branch:
git checkout -b fix/descriptive-name - Make changes and commit
- Push branch:
git push -u origin fix/descriptive-name - Open PR via
gh pr create - Wait for CI to pass — all required checks (Lint, Typecheck, Vitest, Playwright E2E) must be green
- Merge via
gh pr merge --squash --delete-branch - If merge is blocked, check which status check failed and fix it — do not bypass with
--admin
Debugging
- Dev server logs: Run
npx vite devin a fixture directory - RSC streaming issues: Context is often cleared before stream consumption — check AsyncLocalStorage usage
- Module resolution: Vite has separate module instances for RSC/SSR/client environments
Research Tools
Context7 MCP
Context7 provides fast access to up-to-date documentation and source code for libraries. Use it liberally when researching how to implement something or debugging behavior. Key library IDs for this project:/vercel/next.js— Next.js source code and docs/llmstxt/nextjs_llms_txt— Extended Next.js documentation/vitejs/vite-plugin-react— Vite RSC plugin docs
- How Next.js implements
headers()andcookies()internally - AsyncLocalStorage patterns for request-scoped context
- RSC streaming and rendering lifecycle
- Route matching and middleware patterns
EXA Search
Use EXA for web search when you need to find recent discussions, blog posts, GitHub issues, or documentation that isn’t in Context7. Particularly useful for:- Finding workarounds for edge cases
- Understanding how other frameworks solved similar problems
- Locating relevant GitHub issues and discussions