Skip to content
Web Development

Next.js Tutorial: App Router, SEO & Rendering (2026)

Learn Next.js step by step: the App Router, Server Components, rendering options, metadata for SEO, images and how to build and deploy a Next.js website.

Next.js tutorial: code editor with Next.js code on a widescreen monitor, dark theme
Quick answer

Next.js is a React framework for building fast websites and web apps. Create a project with npx create-next-app@latest, add pages as folders inside the app directory (the App Router), use Server Components to fetch data on the server, choose static generation or server rendering per route, and export a metadata object for SEO titles and descriptions. Deploy on Vercel or any Node.js host.

Next.js adds routing, rendering, data fetching and performance features to React, which makes it a popular choice for marketing sites, blogs, ecommerce and SaaS apps. This guide covers the App Router, which is the recommended approach for new projects.

Create a Next.js project

01

Install Node.js

Use a current LTS version.

02

Create the app

Run npx create-next-app@latest my-site and accept the defaults (TypeScript, ESLint, App Router).

03

Run the dev server

Run npm run dev and open http://localhost:3000.

File-based routing with the App Router

FileURL
app/page.tsx/
app/about/page.tsx/about
app/blog/[slug]/page.tsx/blog/any-post
app/layout.tsxShared layout for all pages

A page with SEO metadata

// app/blog/[slug]/page.tsx
import type { Metadata } from 'next'

async function getPost(slug: string) {
  const res = await fetch(`https://api.example.com/posts/${slug}`, { next: { revalidate: 3600 } })
  return res.json()
}

export async function generateMetadata({ params }: { params: Promise<{ slug: string }> }): Promise<Metadata> {
  const { slug } = await params
  const post = await getPost(slug)
  return { title: post.title, description: post.excerpt }
}

export default async function Page({ params }: { params: Promise<{ slug: string }> }) {
  const { slug } = await params
  const post = await getPost(slug)
  return <article><h1>{post.title}</h1><p>{post.body}</p></article>
}

This page is a Server Component: it fetches data on the server, sends ready HTML to the browser and refreshes the cached data every hour.

Rendering options

OptionWhen HTML is createdBest for
Static generationAt build timeMarketing pages, docs, blogs
Incremental revalidationAt build time, refreshed periodicallyBlogs and catalogues that change occasionally
Dynamic server renderingOn each requestPersonalised or frequently changing pages
Client componentsIn the browserInteractive widgets, forms and dashboards

Next.js SEO checklist

Next.js for ecommerce

Next.js is popular for “headless” stores: products and checkout come from a commerce platform such as Shopify, BigCommerce or WooCommerce via APIs, while Next.js renders a fast custom storefront. It offers great performance and design freedom but needs more development work than a standard Shopify theme.

Deploying a Next.js website

Vercel, the company behind Next.js, offers simple Git-based deployment. You can also deploy to any Node.js host, a container platform or as a static export if your site does not need server features.

Compare frameworks in Next.js vs React and learn the basics first in our React tutorial.

Keep learning

More in Web Development

HTML

Learn how HTML structures modern websites — from document basics and semantic elements to forms, media, accessibility, SEO and practical…

CSS

Learn how CSS controls the appearance, layout, responsiveness and visual behaviour of modern websites — from selectors and the box…

JavaScript

Learn JavaScript from the fundamentals to DOM manipulation, events, functions, asynchronous programming, APIs, modules, browser storage and modern frontend development.

PHP

Learn PHP from the fundamentals to server-side programming, forms, databases, APIs, object-oriented programming, WordPress development, security and modern backend development.

React

Learn React from the fundamentals to components, JSX, props, state, hooks, forms, APIs, performance, accessibility, testing and modern frontend application…

Angular

A beginner-friendly Angular tutorial: what Angular is, how components, signals and services work, how to start a project and when…

Vue

Learn Vue.js 3 step by step: create a project, build single-file components, use reactive state with the Composition API and…

Laravel

Learn Laravel from PHP framework fundamentals and MVC architecture to routing, controllers, Blade, Eloquent, databases, APIs, authentication, security, testing, performance…

Latest articles

Related Web Development articles

FAQ

Next.js tutorial: your questions answered

Short, honest answers to the questions people ask most about this topic.

Is Next.js better than React?

Next.js is built on React, so it is not a replacement. It adds routing, server rendering, static generation and performance features, which makes it better suited to full websites than plain React.

Yes. Server rendering and static generation deliver complete HTML to search engines, and the Metadata API, sitemap support and image optimisation make technical SEO easier.

Yes. Learn React fundamentals — components, props, state and hooks — before Next.js, because every Next.js page is a React component.

Yes. Next.js is open source and free. Hosting costs depend on where you deploy, and Vercel has a free hobby tier.

Next step

Keep building your skills

Explore the rest of our Web Development guides, or follow the beginner path step by step.