Nuxt Local Development Guide

Build full-stack applications with Vue using Nuxt, featuring file routing and SSR/SSG, with local hot reloading at localhost:3000 by default.


Nuxt is a full-stack framework based on Vue, offering file routing, server-side rendering (SSR), static site generation (SSG), API routing, and automatic imports, comparable to Next.js in the Vue ecosystem.

Quick Start

npm create nuxt@latest my-nuxt-app
cd my-nuxt-app
npm install
npm run dev

Default localhost Access

PurposeAddress
Development Serverhttp://localhost:3000

To change the port: npm run dev -- --port 3001 or set devServer.port in nuxt.config.ts.

Common Commands

CommandDescription
npm run devDevelopment mode (HMR)
npm run buildProduction build
npm run previewPreview production build
npm run generateStatic site generation (SSG)

Directory Structure

  • pages/: File routing, automatically generates the routing table
  • server/api/: Server-side API routes
  • components/, composables/: Automatic imports, no manual import required

Deployment

Can be deployed to a Node server, Nuxt hosting platform, or generate a pure static site to .output/public.

Summary

Nuxt local development defaults to http://localhost:3000, suitable for Vue full-stack, SEO-friendly SSR applications, and content sites.

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