Let's walk through the App and Pages Router Projects and see how they are setup. You'll feel more confident about the differences between the two routers.
Follow along with the video below and let's build a simple app with both routers.
I'll be repeating a few things from our Hello Next.js project here. Consider this a refresher although I do cover a few new things in-depth.
Let's compare and see how the files and folders are structured for the Pages Router.
Both projects are bootstrapped with the create-next-app CLI, which asks how you want to configure your project. The only prompt that differs is "Would you like to use App Router?": answer yes for the App Router (now the recommended default) or no to opt into the Pages Router. The videos then compare the files each one generates side by side.
src directory, Turbopack as the fast incremental bundler instead of Webpack, and the default @/* import alias.app vs pages directory. In the App Router, a route is exposed with a page.tsx file and layout.tsx wraps the whole app with the html and body elements. In the Pages Router, index.tsx is the root page, _document.tsx holds the Html and body tags from next/document, and _app.tsx is the entry point where you can add a shared header.metadata constant that adds the title and description meta tags to the page head for SEO. The Pages Router uses the Head component from Next.js instead.api folder, so pages/api/hello.ts is served at /api/hello. The App Router has no api folder and uses Route Handlers instead.public folder, global CSS, next.config, Tailwind and PostCSS configs, and tsconfig.json. Fonts work the same way in both._app.tsx and index.tsx to the browser because they are Client Components. The App Router's page.tsx is a Server Component, so it never gets downloaded.