pages/ and app/ directories at startup and hot-reloaded when files change.
Pages Router
The Pages Router follows the original Next.js routing conventions:Basic Routes
Dynamic Routes
Dynamic segments are defined using square brackets:pages/posts/[id].tsx
Catch-All Routes
Catch-all routes capture multiple segments:API Routes
API routes are defined inpages/api/:
pages/api/hello.ts
Route Precedence
vinext matches routes following Next.js specificity rules:- Static routes (most specific)
- Dynamic routes (by position — earlier is more specific)
- Catch-all routes
- Optional catch-all (least specific)
App Router
The App Router introduces a more powerful routing system with layouts, loading states, and parallel routes.File Conventions
Basic Routes
Layouts
Layouts wrap multiple pages and persist across navigation:/dashboard/analytics to /dashboard/settings, the dashboard layout persists — only the page component re-renders.
Route Groups
Route groups organize files without affecting the URL structure:Dynamic Routes
Dynamic routes work the same as Pages Router:app/posts/[id]/page.tsx
vinext supports both
await params (Next.js 15+) and direct property access params.id (pre-15) via thenable objects.Parallel Routes
Parallel routes allow rendering multiple pages in the same layout:app/dashboard/layout.tsx
default.tsx is rendered:
app/dashboard/@analytics/default.tsx
Intercepting Routes
Intercepting routes allow showing a different page when navigating from within the app:app/feed/@modal/(.)photos/[id]/page.tsx
/photos/123 renders the regular route instead.
Route Matching Implementation
vinext converts Next.js file conventions to internal URL patterns:packages/vinext/src/routing/pages-router.ts
Precedence Scoring
Routes are sorted by specificity using a scoring algorithm:packages/vinext/src/routing/pages-router.ts
Route Discovery
Routes are discovered at startup and cached:packages/vinext/src/routing/pages-router.ts
invalidateRouteCache() when the directory structure changes.
i18n Routing
vinext supports internationalized routing for Pages Router:next.config.js
/→ default locale (en)/fr→ French/fr/about→ French about page
useRouter() hook exposes the current locale:
Domain-based i18n routing is not supported. Only path-based locale prefixes work.
basePath
Deploy your app under a URL prefix:next.config.js
pages/index.tsx→/docspages/getting-started.tsx→/docs/getting-started- Links and navigation respect the basePath automatically
trailingSlash
Force URLs to end with or without a trailing slash:next.config.js
/about→/about/(withtrailingSlash: true)/about/→/about(withtrailingSlash: false)
Next Steps
Server Components
Learn how RSC integration works in App Router
Caching & ISR
Understand incremental static regeneration
Architecture
Deep dive into vinext’s architecture
API Routes
Build API endpoints