How to create a new Node.js project

Creating a new Node.js project requires proper initialization and directory structure for building scalable applications. As the creator of CoreUI, a widely used open-source UI library, I’ve created hundreds of Node.js projects for build tools, APIs, and enterprise backend services. From my expertise, the most efficient approach is to initialize with npm and create a clean project structure. This method ensures proper dependency management and maintainable code organization.

Initialize a new directory with npm init and create basic project structure.

mkdir my-project && cd my-project
npm init -y
mkdir src
echo 'console.log("Hello Node.js!")' > src/index.js
node src/index.js

The mkdir command creates your project directory, then cd navigates into it. The npm init -y command initializes a new Node.js project with default settings, creating a package.json file. Creating a src directory organizes your source code, and the basic index.js file serves as your application entry point.

Best Practice Note:

This is the same approach we use in CoreUI backend projects for clean organization.


Speed up your responsive apps and websites with fully-featured, ready-to-use open-source admin panel templates—free to use and built for efficiency.


About the Author

Subscribe to our newsletter
Get early information about new products, product updates and blog posts.
Javascript Random - How to Generate a Random Number in JavaScript?
Javascript Random - How to Generate a Random Number in JavaScript?

How to Hide Scrollbar with CSS
How to Hide Scrollbar with CSS

How to Detect a Click Outside of a React Component
How to Detect a Click Outside of a React Component

How to Clone an Object in JavaScript
How to Clone an Object in JavaScript

Answers by CoreUI Core Team