Next.js
An all-in-one website toolkit built on React that wires up URLs, page rendering, data loading, and publishing for you.
On this page
What is Next.js?
Next.js is a website framework built on top of React. React helps you build pages out of reusable blocks (called “components”, like buttons and cards). Next.js adds the rest of what a full website needs: matching URLs to pages (routing), deciding where pages are built (rendering), loading data, and packing everything to go live.
If React is a big box of LEGO bricks, Next.js is the instruction manual, baseplate, and assembly line: same bricks, but you get clear rules for snapping them into a finished website.
Next.js is not a new language and does not replace React—it is a set of helpful tools and conventions built on top of React.
How do you go from a new project to a live site?
Next.js maps out the four main steps from starting a project to putting it online.
Set up the starter box: run
create-next-appto get folders, settings, and a local preview server in one go.Drop pages into folders: put page files inside the
appfolder, and each file’s folder path automatically becomes its web address.Pick how each page is made: choose ahead-of-time static pages, server-built pages, or browser-drawn pages depending on what each page needs.
Pack and publish: run the build command so Next.js bundles and shrinks your files, then put them on a hosting platform or your own server.
Following these built-in rules saves tons of setup work, though it also means your project needs to follow Next.js’s folder habits.
Look at the tiniest page
The smallest Next.js page is just one file that hands back a React block (component).
- Put the file at
app/page.tsx(a code file for writing page blocks), and whatever it returns appears on that page. app/page.tsxbecomes the home page/. Addapp/about/page.tsxand your site automatically gets an/aboutpage.- Start the local dev server and open the home page to see that big heading.
Even if the code is new to you, these three lines do just one thing—show the heading Hello, Next.js! on the home page:
// app/page.tsx
export default function HomePage() {
return <h1>Hello, Next.js!</h1>;
}You never have to write a separate list matching URLs to files: where you place the file decides the web address.
How is Next.js different from using React alone?
React draws the interface; Next.js turns that interface into a complete, ready-to-launch website.
| Compare | Next.js | React alone |
|---|---|---|
| Matching URLs to pages (routing) | Automatic from folder paths—add a file, get a URL | Pick a separate routing library and wire it up yourself |
| How pages are built (rendering) | Choose static ahead-of-time, server-built, or browser-drawn | Drawn in the visitor’s browser by default |
| Packing and publishing | Bundling, image optimization, and launch habits built in | Choose and connect your own build tools step by step |
Using React alone is like picking individual computer parts to assemble yourself; Next.js is like buying a ready-to-use computer with the common essentials already connected.
When is Next.js a good fit?
Next.js shines when your site needs both pages and small backend features, or cares about fast first impressions and search engines.
- Content sites: blogs, tutorials, and docs whose pages can be built ahead of time for speedy loading.
- Pages meant for search engines: building pages ahead of time or on the server puts real text in the initial HTML so Google can read it right away.
- Small-team full-stack apps: web pages and backend data endpoints live neatly inside one project.
Clear rules, everything ready out of the box, and static pages can sit right next to dynamic backend endpoints.
You have to follow the framework’s rules and keep up with version updates. For just two or three super-simple static pages, Next.js can feel like using a delivery truck to carry one book.
Common things people get wrong
Does Next.js mean I do not need to learn React?
No. Next.js uses React bricks under the hood, so you still write pages using React.
Is every Next.js website automatically fast?
No. Huge images, slow data lookups, or the wrong rendering choice can still make a site slow. Next.js gives you great tools, not magic.
Can Next.js only be hosted on Vercel?
No. Vercel is made by the same company so setup is effortless, but you can also run Next.js on other Node.js servers, in Docker containers, or even export it as a static website.
Quick quiz
In Next.js, what do you usually do to add a new /about page?
Add one file. Place a file that exports a page component at app/about/page.tsx, and the /about address starts working automatically—no extra registration needed.
Remember this: Next.js uses folder paths as web addresses and bundles common website setup into clear conventions.
Read further
These official guides are a great next step.