How to Create a Next.js Project in 2024
Nextjs is a full stack frontend framework built on top of Reactjs
I have been using Nextjs since 2021. I have never switched from Nextjs since then because of the features it provides.
Nextjs is well loved by developer community because it lets developer focus on the building thing that matters.
So, many developers have started adopting Nextjs as their full stack framework, especially Indie SaaS Developers.
This tutorial guides you step-by-step to create a new Nextjs Project.
To create a new Nextjs project, follow these steps
Go to the File Explorer and open directory where you want to create project
Open directory in your file explorer where you want to create new project
Open CMD in the directory
Type CMD in the address bar of the file explorer and press ENTER
After the Command Prompt (CMD) opens, we have to type some command for creating new Nextjs project
Type the following command
npx create-next-app project-name
After this, you will be asked to make the different choices.
Choose, Yes if you want to create Nextjs app with Typescript. I am choosing No for now
This option is for choosing to create project with or without ESLint
You can configure Tailwind CSS by default in Nextjs project, you can choose yes, if you want to setup Tailwind CSS in installation itself
You can put all the code inside the src
directory. It makes the project structure cleaner and concise.
If you are a beginner, and just getting started with nextjs then don’t use app router for now. Get familiar with the usual (page router).
But if you are already experienced, you can choose App Router. App Router has lots of benefits and mind blowing features.
It is a option for customizing import alias.
If you choose No, your component import will look like
import UserProfile from @/components
If you choose Yes, you can set custom alias, for-example ‘app’
Now your component import will look like
import UserProfile from @app/components
You can choose as per your likings.
Installation Started
Now the projects start getting initialized.
After, installation completes.
Go inside the project in terminal by following command
cd project-name
and type following command to run Nextjs app
npm run dev
After that, You will see something like this
This means, your project is setup successfully.
Now go to your browser and type localhost:3000
You will see this view.
Congratulations, you have successfully created a new Next.js project. 🎉
PlainEnglish.io 🚀
Thank you for being a part of the In Plain English community! Before you go:
- Be sure to clap and follow the writer️
- Learn how you can also write for In Plain English️
- Follow us: X | LinkedIn | YouTube | Discord | Newsletter
- Visit our other platforms: Stackademic | CoFeed | Venture