What is Next.js?

The React framework for production. Adds SSR, SSG, file-based routing, API routes, and image optimization — everything needed to build a complete web app.

Vercel2016v14+MIT LicenseReact-based

🔄 How Next.js Handles a Request

👤UserRequest URLNext.js ServerRouting📄SSR / SSG / ISRRender mode⚙️API Routes/api/*🗄️DatabaseFetch data🌐BrowserHTML + Hydrate✅ Pre-rendered HTML delivered fast → Hydrated to interactive React app

🖥️ Rendering Modes

📦
SSG
Static Site Generation

Pages rendered at build time. Super fast, can be served via CDN. Best for blogs, docs, marketing pages.

Use when: Content rarely changes
⚙️
SSR
Server-Side Rendering

Pages rendered on server per request. Always fresh data. Good SEO. Best for dashboards, user-specific pages.

Use when: Data changes every request
🔄
ISR
Incremental Static Regeneration

Static pages that auto-regenerate in background after a set time (e.g., every 60s). Best of both worlds.

Use when: Data changes occasionally
🌐
CSR
Client-Side Rendering

Page loads skeleton → Fetch data in browser. Like plain React. No SEO benefit. Good for private dashboards.

Use when: SEO not needed, user-specific

✨ Key Features

📂
File-based Routing

Create a file in /pages → Automatic route. No router config needed. /pages/about.js → /about

📡
API Routes

Create /pages/api/hello.js → Gets /api/hello endpoint. Full Node.js backend built-in.

🖼️
Image Optimization

next/image auto-resizes, converts to WebP, lazy loads, and prevents layout shift.

🔒
Middleware

Run code before request completes. Use for auth checks, redirects, A/B testing, i18n.

Edge Runtime

Run code at CDN edge nodes globally. Ultra-low latency. Faster than traditional server.

📱
App Router (v13+)

New /app directory with Server Components, nested layouts, parallel routes, streaming.

⚖️ React vs Next.js

Topic⚛️ React▲ Next.js
RoutingManual (React Router)File-based (automatic)
SEOPoor (CSR only)Excellent (SSR/SSG)
BackendSeparate server neededBuilt-in API Routes
PerformanceGood (SPA)Excellent (pre-rendered)
Image handlingManual optimizationBuilt-in next/image
DeploymentStatic files / NodeVercel / Node / Docker

Want a Next.js website? ▲

We build fast, SEO-friendly web apps with Next.js, TypeScript, and Tailwind CSS.

← Back to LearnContact Us