ConfigsApr 13, 2026·3 min read

Next.js — The Full-Stack React Framework for the Web

Next.js is the most popular React framework for building full-stack web applications. It provides server-side rendering, static generation, API routes, file-based routing, and React Server Components — making React production-ready out of the box.

TL;DR
Next.js provides SSR, static generation, API routes, file-based routing, and React Server Components for full-stack React apps.
§01

What it is

Next.js is a React framework by Vercel that handles the full stack: server-side rendering (SSR), static site generation (SSG), API routes, and React Server Components. It uses file-based routing where the directory structure under app/ defines your URL paths.

Next.js is the default choice for teams building React applications that need SEO, fast initial page loads, and a unified frontend-backend codebase. It powers sites from personal blogs to large-scale e-commerce platforms.

§02

How it saves time or tokens

Next.js eliminates the need to configure Webpack, Babel, and SSR plumbing manually. React Server Components let you fetch data on the server without sending the fetch logic to the browser, reducing client-side JavaScript. The built-in image optimization, font loading, and code splitting mean fewer manual performance tweaks.

§03

How to use

  1. Create a new Next.js project with create-next-app.
  2. Add pages by creating files in the app/ directory.
  3. Deploy to Vercel or any Node.js hosting.
# Create a new project
npx create-next-app@latest my-app
cd my-app
npm run dev
# Open http://localhost:3000
§04

Example

// app/page.tsx - A Server Component by default
export default async function Home() {
  const posts = await fetch('https://api.example.com/posts').then(r => r.json());

  return (
    <main>
      <h1>Blog</h1>
      {posts.map((post: any) => (
        <article key={post.id}>
          <h2>{post.title}</h2>
          <p>{post.excerpt}</p>
        </article>
      ))}
    </main>
  );
}
§05

Related on TokRepo

§06

Common pitfalls

  • Mixing client and server components incorrectly causes hydration errors. Mark interactive components with 'use client' and keep data-fetching in server components.
  • The app/ router and pages/ router cannot coexist for the same route. Migrate incrementally but do not duplicate route paths.
  • Large dependency bundles negate SSR performance gains. Use next/dynamic for lazy loading heavy client-side libraries.

Frequently Asked Questions

What is the difference between app/ and pages/ router in Next.js?+

The app/ router (introduced in Next.js 13) uses React Server Components, nested layouts, and streaming by default. The pages/ router is the older approach using getServerSideProps and getStaticProps. New projects should use the app/ router. The pages/ router remains supported for backward compatibility.

Does Next.js require Vercel for deployment?+

No. Next.js can be deployed to any Node.js hosting, Docker container, or serverless platform. Vercel provides the smoothest deployment experience since they build Next.js, but AWS, Google Cloud, and self-hosted Node.js servers work fine.

How does Next.js handle SEO?+

Next.js renders pages on the server by default, so search engine crawlers receive fully rendered HTML. The Metadata API lets you define title, description, and Open Graph tags per page. Combined with automatic sitemap generation, Next.js provides strong SEO foundations out of the box.

Can I use Next.js for a pure API backend?+

Yes. Next.js API routes (route.ts files in the app/ directory) let you build REST or GraphQL endpoints. However, for API-only projects without a frontend, a lighter framework like Express or Fastify may be more appropriate.

What is React Server Components and why does it matter?+

React Server Components run on the server and send rendered HTML to the browser without the component JavaScript. This reduces client-side bundle size and lets you access databases or file systems directly in components. Interactive parts still use client components with 'use client' directive.

Citations (3)
  • Next.js GitHub— Next.js provides SSR, SSG, API routes, and React Server Components
  • Next.js Documentation— Next.js app router and React Server Components documentation
  • React Official Docs— React Server Components reduce client-side JavaScript by running on the server

Discussion

Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.

Related Assets