Member-only story

Setting Up a Node.js Project: Best Practices for Beginners

Ruchir Gupta
2 min readFeb 1, 2025

1. Installing Node.js and npm

Before setting up a Node.js project, you need to install Node.js and npm (Node Package Manager).

node -v 
npm -v

2. Initializing a New Node.js Project

Create a new project folder and initialize a package.json file:

mkdir my-node-app
cd my-node-app
npm init -y
  • This generates a package.json file, which stores project metadata and dependencies.

3. Setting Up a Git Repository

Initialize a Git repository for version control:

git init
echo "node_modules/" >> .gitignore
  • Create a .gitignore file to exclude unnecessary files like node_modules.

4. Installing Essential Dependencies

Depending on your project, install required packages.
For an Express.js app:

npm install express

For development dependencies (like Nodemon for auto-reloading):

npm install --save-dev

Create an account to read the full story.

The author made this story available to Medium members only.
If you’re new to Medium, create a new account to read this story on us.

Or, continue in mobile web

Already have an account? Sign in

Ruchir Gupta
Ruchir Gupta

Written by Ruchir Gupta

Software Developer at Accenture India, Ex-Software Engineer at Roblox Corporation.

No responses yet

Write a response