Steps to create Next app with “src” directory

Step 1: Create a new Next.js project with the given command

npx create-next-app my-app

Step 2: Move to project and Create an src directory inside the root directory of your Next.js project called src.

cd my-app
mkdir src

Step 3: Move necessary files to the src directory, such as your pages, stylesheets, or any other files that your project may need.

mv pages/ src/
mv styles/ src/
mv public/ src/

Next.js src Directory

The Next JS src directory, short for source directory is the primary location for your application’s source code. It is an alternate project format that typically contains all the components, pages, styles, and other assets needed for your application to function. In a Next.js project, the src directory is where you will spend most of your time coding.

Similar Reads

What does the next js src directory contain

The src directory is where you’ll typically store your application’s source code files. It is the heart of your application and is where you’ll write most of your application’s logic. The directory is usually located at the root of your project, alongside other top-level directories such as pages, public, components, and styles....

Steps to create Next app with “src” directory

Step 1: Create a new Next.js project with the given command...

Project Structure

The prohject structure will look like this...