Next.js Local Development Guide

Build full-stack React applications with Next.js, featuring App Router support for SSR/SSG, with localhost defaulting to localhost:3000.


Next.js is a full-stack framework based on React, offering App Router, server components, API routes, static exports, and edge deployment. It is widely used for production-level web applications and marketing sites.

Quick Start

npx create-next-app@latest my-app
cd my-app
npm run dev

Default localhost Access

PurposeAddress
Development Serverhttp://localhost:3000

To change the port: npm run dev -- -p 3001 or adjust in package.json.

Common Commands

CommandDescription
npm run devDevelopment mode (Turbopack optional)
npm run buildProduction build
npm run startRun production server
npm run lintESLint check

Routing and Rendering

  • App Router (directory app/): Recommended for new projects
  • Supports SSR, SSG, ISR, and mixing client components
  • API and Server Actions can implement backend logic within the same repository

Deployment

Can be deployed to Vercel (official platform), Node servers, Docker, or generate a pure static site using output: 'export'.

Summary

Next.js local development defaults to http://localhost:3000, suitable for React full-stack and SEO-friendly modern web applications.

访客计数:------ Best viewed in Netscape Navigator · 800×600 © LocalHost Run