| 1 | read_wiki_structure | {"repoName":"vercel/next.js"} | OK Available pages for vercel/next.js:
- 1 Next.js Repository Overview
- 1.1 Monorepo Structure and Package Ecosystem
- 1.2 Getting Started and Developer Setup
- 2 Build System
- 2.1 Webpack Build Pipeline
- 2.2 Turbopack Build Pipeline
- 2.3 SWC Transforms and Native Bindings
- 2.4 Static Export and Prerendering
- 3 Server Runtime
- 3.1 Base Server and Request Routing
- 3.2 App Rout |
| 2 | ask_wiki_question | {"repoName":"vercel/next.js","question":"How does routing work, and what is the difference between the App Router and the Pages Router? Where is each implemented in the codebase?"} | OK Next.js routing is handled by two main routers: the App Router and the Pages Router. The App Router is newer and supports React Server Components, while the Pages Router is the original system for traditional React applications . Both routers are implemented within the Next.js server runtime, which manages HTTP requests, routing, and rendering responses .
## Routing Mechanism
At its core, Next.j |
| 3 | ask_wiki_question | {"repoName":"vercel/next.js","question":"Describe the Pages Router rendering pipeline: PagesModule, pages-handler.ts handleRequest, _app/_document, getStaticProps/getServerSideProps/getInitialProps. Concise, max 250 words."} | OK The Pages Router rendering pipeline in Next.js processes incoming requests through `pages-handler.ts`, which uses `PagesRouteModule` to prepare and trace the request. The core rendering is handled by `render.tsx`'s `renderToHTML` function, which executes data-fetching methods like `getStaticProps`, `getServerSideProps`, or `getInitialProps`, and then renders the page components within the `_app` a |
| 4 | ask_wiki_question | {"repoName":"vercel/next.js","question":"How does client-side navigation differ between the App Router client runtime and the Pages Router client? Cover the router cache, prefetching, and the shared router reducer. Concise, max 250 words."} | OK Client-side navigation in Next.js differs significantly between the App Router and Pages Router, particularly concerning caching, prefetching, and the router reducer. The App Router utilizes a granular segment cache and a sophisticated prefetching scheduler, managed by a shared router reducer, to enable instant client-side transitions and partial rendering. In contrast, the Pages Router relies on |
| 5 | ask_wiki_question | {"repoName":"vercel/next.js","question":"Describe the App Router server rendering pipeline (RSC): the LoaderTree, AppPageRouteModule, renderToHTMLOrFlight, layouts/nested routing, and streaming. Keep it concise, max 250 words."} | OK The App Router server rendering pipeline in Next.js utilizes React Server Components (RSC) to deliver streamed responses, either as Flight payloads or full HTML documents. The process is orchestrated by `AppPageRouteModule` and centers around the `renderToHTMLOrFlight` function.
## App Router Server Rendering Pipeline
### LoaderTree
The `LoaderTree` is a nested tuple structure that defines the |
| 6 | ask_wiki_question | {"repoName":"vercel/next.js","question":"List the main conceptual differences between App Router and Pages Router: routing conventions (layouts, templates, loading, error, route groups, dynamic segments), data fetching, and caching semantics. Bullet points only, max 300 words."} | OK The App Router and Pages Router in Next.js have fundamental differences in their routing conventions, data fetching mechanisms, and caching semantics.
## Routing Conventions
* **File Structure**: The App Router uses an `app` directory where folders define URL segments and special files like `page.js` or `route.js` make a route publicly accessible . The Pages Router uses a `pages` directory wher |
| 7 | ask_wiki_question | {"repoName":"vercel/next.js","question":"In BaseServer, how is an incoming request matched to a route and how does the server decide between an App Router route and a Pages Router route (RouteKind matching, appPathsManifest vs pagesManifest, precedence, rewrites/redirects, middleware)? Concise, max 250 words."} | OK In `BaseServer`, an incoming request is matched to a route through a process that involves loading route manifests, handling rewrites and redirects, and then using `RouteKind` to distinguish between App Router and Pages Router routes. The server prioritizes custom routes (rewrites, redirects, headers) before attempting to match filesystem routes.
## Route Matching Process
The `BaseServer` init |