Introduction to Next.js
Next.js is a React framework for building full-stack web applications. It adds file-based routing, optimized bundling, and first-class support for server rendering and static generation on top of React, so you can ship fast, SEO-friendly pages without assembling tooling from scratch.
Create a project
Use the official starter with your preferred package manager:
npx create-next-app@latest my-app
cd my-app
npm run dev
During setup you can enable TypeScript, ESLint, Tailwind CSS, and the App Router (app/). The dev server typically runs at http://localhost:3000.
Project structure (App Router)
A typical layout looks like this:
my-app/
├── app/
│ ├── layout.tsx # Root layout (shell, fonts, providers)
│ ├── page.tsx # Home route (/)
│ └── globals.css
├── public/ # Static assets
├── next.config.mjs
└── package.json
app/page.tsx is the entry for /. Nested folders under app/ map to URL segments; layout.tsx wraps child routes and persists across navigations.
Your first page
// app/page.tsx
export default function Home() {
return (
<main>
<h1>Hello, Next.js</h1>
</main>
);
}
Export a default React component from page.tsx for each route. Metadata and data loading integrate here without a separate router config file.
Next.js vs Nuxt
Both are meta-frameworks with file-based routing and SSR/SSG. Nuxt is Vue-centric (Vite or webpack under the hood) with conventions like pages/ and layouts/. Next.js is React-centric and uses the app/ directory (or legacy pages/) with React Server Components by default in the App Router. If your team is on Vue, Nuxt is the natural fit; for React ecosystems and hiring pools, Next.js is the standard choice. Conceptually—layouts, dynamic routes, and hybrid rendering—map closely between the two.