Next.js is a React framework for building full web applications. It adds file-based routing, server rendering, static generation, data fetching, API endpoints and a build toolchain on top of React, so you do not assemble those pieces yourself. If you are asking what is nextjs, think of it as React plus the decisions and tooling needed for production sites.
Use it when you need good SEO, fast first loads or a front end and server code in one project. A plain React app built with a bundler is enough when you only need a private, highly interactive single-page app.
React itself is a library for building user interfaces. It does not tell you how to route between pages, fetch data on a server or split code. Next.js supplies:
You need a current LTS version of Node.js. Create an app with the official generator:
The prompts ask about TypeScript, linting, Tailwind CSS and the App Router. Open http://localhost:3000 to see the starter page. Prefer the App Router, which is the current default; the older Pages Router still works for existing projects.
Inside the app folder, each folder is a URL segment and a page.tsx file makes it reachable:
A page is a React component exported by default:
A layout.tsx wraps the pages below it and keeps its state when you navigate. Dynamic segments use square brackets, such as [slug].
Components in the App Router are server components by default. They can be async, read a database or call an API directly, and their code never reaches the browser.
When a component needs state, effects or browser events, add the "use client" directive at the top of the file. Keep client components small and push them to the leaves of the tree.
| Strategy | When HTML is built | Good for |
|---|---|---|
| Static | At build time | Docs, marketing pages, blogs |
| Dynamic (SSR) | On each request | Personalised or live data |
| Revalidated static | Build time, refreshed after a period | Catalogues, news lists |
| Client-side | In the browser | Dashboards, widgets |
Which strategy a route gets depends on what it uses, such as cookies, headers or uncached fetches. Caching behaviour has changed between major releases, so read the documentation for the version you install.
Good fits:
Weaker fits:
Both, in a limited way. It is mainly a front-end framework, but route handlers and server actions let it run server code such as database queries.
Yes. Components, props, state and hooks are used in every Next.js page.
The framework is open source. You can host it on your own Node.js server, in a container or on a managed platform, which may charge.
The App Router uses the app folder, server components and nested layouts. The Pages Router uses the pages folder and an older data-fetching model.
Next.js turns React into a full framework with routing, server rendering, static generation and backend hooks. Start with the App Router, keep components on the server unless they need interactivity, and choose static or dynamic rendering per route. Use it when SEO and fast first loads matter, and choose a simpler setup when they do not.