Next.js
web development
JavaScript
React
programming tutorial
front-end development
software development

How to Start a Next.js Project: A Step-by-Step Guide

Listen to article
Deepak Tewatia
October 8, 2025
3 min read

Introduction

Starting a Next.js project is easy! First, make sure you have Node.js installed. Then, open your terminal and run a simple command to create a new app. After that, you can add pages and styles to make your project look great. Let’s go through the steps together!

Step 1: Install Node.js

To begin, you need Node.js on your computer. This is a tool that helps you run JavaScript outside of a web browser. You can download it from the official Node.js website. Choose the version that matches your operating system and follow the instructions to install it.

Step 2: Create a New Next.js App

Once you have Node.js installed, it’s time to create your Next.js project. Open your terminal and run the following command:

npx create-next-app@latest my-next-app

This command creates a new directory called my-next-app with all the files you need. Feel free to replace my-next-app with whatever name you want for your project.

Step 3: Navigate to Your Project Directory

Next, you need to go inside your new project directory. Run this command in the terminal:

cd my-next-app

Step 4: Start the Development Server

Now, you’re ready to see your app in action. Start the development server by running:

npm run dev

Your server will start, and you should see a message like this:

Local: http://localhost:3000

Open your web browser and go to http://localhost:3000. You will see your new Next.js app!

Step 5: Explore the Project Structure

Take a moment to look at the files and folders inside your project. Here are some key folders you will see:

  • pages: This is where you create your app’s pages. Each file in this folder will become a route in your app.
  • public: Use this folder to store images and other static files.
  • styles: This is where you can add CSS files to style your app.

Step 6: Create a New Page

Creating a new page is straightforward. Go to the pages directory and create a new file called about.js. Inside this file, add the following code:

export default function About() {
    return <h2>About Page</h2>;
}

Now, if you visit http://localhost:3000/about, you will see your new About page!

Step 7: Add Some Styles

To make your app look nicer, you can add CSS styles. Open the styles/globals.css file and add your CSS rules there. For example:

body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f0f0f0;
}

This simple CSS will set the font and background color for your entire app.

Step 8: Build and Deploy Your App

Once you are happy with your app and ready to share it with the world, you can build it for production. Run the following command:

npm run build

This will create an optimized version of your app in the .next folder. To deploy your app, you can use platforms like Vercel or Netlify. These platforms make it easy to deploy Next.js apps.

Conclusion

And that’s it! You have started a Next.js project and created your first page. With Next.js, you can build amazing web apps quickly and easily. Keep exploring the framework to learn more about features like API routes, static site generation, and more. Happy coding!

Comments

Y
You
Commenting
0/2000
Loading comments…