next

Frameworks

Next.js CLI allows you to develop, build, start your application, and more. A React framework for production with built-in optimizations.

Usage

npx next [command] [options]

Options

dev

Starts Next.js in development mode with Hot Module Reloading

Type: command

build

Creates an optimized production build of your application

Type: command

start

Starts Next.js in production mode

Type: command

info

Prints relevant details about the current system

Type: command

telemetry

Allows you to enable or disable Next.js telemetry collection

Type: command

typegen

Generates TypeScript definitions for routes without running a full build

Type: command

upgrade

Upgrades your Next.js application to the latest version

Type: command

experimental-analyze

Analyzes bundle output using Turbopack

Type: command

--help, -h

Shows all available options

Type: option

--version, -v

Outputs the Next.js version number

Type: option

--turbopack

Force enable Turbopack (enabled by default)

Type: option

--webpack

Use Webpack instead of Turbopack

Type: option

--port, -p

Specify a port number (default: 3000)

Type: option

--hostname, -H

Specify a hostname (default: 0.0.0.0)

Type: option

--experimental-https

Starts the server with HTTPS

Type: option

--debug

Enables verbose build output

Type: option

--profile

Enables production profiling for React

Type: option

--no-lint

Disables linting during build

Type: option

--verbose

Show verbose output during upgrade

Type: option

Examples

Start development server

npx next dev

Build for production

npx next build

Start production server

npx next start

Start dev server on custom port

npx next dev -p 4000

Build with debug output

npx next build --debug

Enable HTTPS in development

npx next dev --experimental-https

Generate TypeScript types

npx next typegen

Upgrade to latest version

npx next upgrade

Analyze bundle output

npx next experimental-analyze

Get system information

npx next info

Language

TypeScript & JavaScript (Rust core)

History

Next.js was created by Guillermo Rauch in 2016 as a React framework that provides a great developer experience with features like server-side rendering, static site generation, and API routes.

The framework has evolved significantly since its initial release, adding features like the App Router, Turbopack bundler, and improved performance optimizations. Next.js is now one of the most popular React frameworks, used by companies like Netflix, TikTok, and Uber.

In 2022, Next.js introduced the App Router as a new way to build applications, replacing the Pages Router. The App Router provides better performance, improved developer experience, and new features like Server Components.

Next.js continues to evolve with regular updates, focusing on performance, developer experience, and modern web standards.

Characteristics

Next.js provides a complete solution for building React applications with built-in optimizations for performance, SEO, and user experience. Key features include:

  • Server-Side Rendering (SSR): Renders pages on the server for better performance and SEO
  • Static Site Generation (SSG): Pre-renders pages at build time for optimal performance
  • API Routes: Build API endpoints as part of your Next.js application
  • Image Optimization: Automatic image optimization with modern formats
  • Font Optimization: Automatic font loading and optimization
  • TypeScript Support: Built-in TypeScript support with automatic type generation
  • Fast Refresh: Hot module replacement for instant updates during development

The framework uses Turbopack (written in Rust) for fast builds and development, providing significantly better performance than traditional bundlers.