Flash Sale:75% Off Hosting + Free DomainEnds in13h47m14sView Plans
Hostvento logoHostvento

How to Set Up Next.js with Node.js

Install Node.js, create a Next.js project and start the development server.

How-To Guides2 min read6 screenshots

Install Node.js on Windows

Step 1: Download Node.js

Download the LTS installer from nodejs.org.

Downloading Node.js

Step 2: Run the installer

Open the file and follow the wizard. Keep the default options.

Step 3: Check the installation

Open a new terminal:

node -v
npm -v
The Node.js and npm versions

(On Linux and macOS use your package manager or nvm.)

Create a Next.js project

Step 1: Create the app

npx create-next-app@latest my-nextjs-app
Creating a Next.js project

Answer the questions (TypeScript, ESLint, Tailwind CSS, the App Router and so on). The tool installs the packages.

Installing the Next.js app

Step 2: Go to the folder

cd my-nextjs-app
Opening the project folder

Step 3: Start the development server

npm run dev
Starting the development server

Open http://localhost:3000 in your browser.

Step 4: Look at the project

  • app/ (or pages/ in the older Pages Router) holds your pages. Each file becomes a route.
  • public/ holds static files such as images and fonts.
  • styles/ or app/globals.css holds the global CSS.
  • package.json lists the scripts and packages.

Build for production

npm run build
npm run start

npm run start runs the production server on port 3000.

Features of Next.js

  • Server-side rendering and static generation for fast pages and good SEO.
  • File-based routing. No router setup.
  • API routes and server actions for back-end code.
  • Image optimization and built-in CSS support.
  • Hot reload while you develop.

Quick recap

  • Install Node.js, run npx create-next-app@latest, then npm run dev.