Member-only story
Setting Up a Next.js Project — Installation and Folder Structure
Next.js is a powerful React framework that enables developers to build fast, SEO-friendly, and scalable web applications. In this guide, we will walk through the steps to install Next.js and understand its default folder structure.
Prerequisites
Before starting, ensure you have the following installed on your system:
- Node.js (recommended version 16 or later) — Download from nodejs.org
- npm or yarn (comes with Node.js)
Step 1: Installing Next.js
Next.js can be installed in a few simple steps. Open your terminal and run the following command:
Using npm:
npx create-next-app@latest my-next-app
Using yarn:
yarn create next-app my-next-app
Replace my-next-app
with your desired project name. This command will create a new Next.js project and install all the necessary dependencies.
Once the installation is complete, navigate to your project folder:
cd my-next-app
Start the development server:
npm run dev