Creating a Next.js Application
Learn about Creating a Next.js Application in Next.js.
Creating a Next.js Application
Next.js is a React framework that helps you build fast, production-ready web applications. To create a new Next.js project, you need Node.js installed.
Step 1: Install Node.js
Before creating a Next.js app, make sure Node.js is installed. Open your terminal and run:
node -v npm -v
If you do not see version numbers, install Node.js first from nodejs.org.
Step 2: Create a New Project on Windows
- Open Command Prompt or PowerShell.
- Navigate to the folder where you want the project:
cd Documents\Projects
- Run the create-next-app command:
npx create-next-app@latest my-next-app
- Answer the questions that appear on the screen. For beginners, choose these options:
- Would you like to use TypeScript? No
- Would you like to use ESLint? Yes
- Would you like to use Tailwind CSS? Yes
- Would you like to use src directory? No
- Would you like to use App Router? Yes
- Would you like to customize the default import alias? No
- Wait while the project is created.
- Move into the project folder:
cd my-next-app
Step 3: Create a New Project on Linux
- Open a terminal.
- Navigate to the folder where you want the project:
cd Documents/Projects
- Run the create-next-app command:
npx create-next-app@latest my-next-app
- Choose the same beginner options as listed in the Windows section.
- Move into the project folder:
cd my-next-app
Step 4: Run the Development Server
Inside the project folder, run:
npm run dev
This starts the development server. Open your browser and go to:
http://localhost:3000
You should see the Next.js welcome page.
Step 5: Edit the Project
Open the project in any code editor. Try editing the file app/page.tsx (or app/page.js). Change some text and save. The browser will automatically update.
Practice
Create a Next.js app on your computer, run the development server, and change the welcome page text to your name.