How to install Node js and MongoDB

In this section, we will learn:

  1. How to install Node js

  2. How to set up MongoDB using MongoDB Atlas (cloud-based)


🟒 Step 1 Install Node js

Node.js is a JavaScript runtime used to run JavaScript code outside the browser. It is required to run backend applications.

βœ… Installation Steps

  1. Search on Google:

    sh
    nodejs

  • Click the official website: https://nodejs.org

  • You’ll see two versions:

    • LTS (Long Term Support) – Recommended for most users

    • Current – Includes latest features

  • Choose your Operating System (Windows, macOS, Linux) and download the LTS version.

  • Once the download finishes, open the installer and follow the steps:

    • Click Next β†’ Accept License β†’ Click Next β†’ Complete Installation.

πŸ§ͺ Verify Installation

Open Command Prompt (CMD) or Terminal and type:

sh
node -v

If it shows the Node.js version, installation was successful.

Then try:

sh
node

You’ll enter the Node.js interactive shell. Type:

sh
2 + 2

You should see:

sh
4

Press Ctrl + C twice to exit.

πŸ“Š Diagram: Node.js Installation Flow

sh
Google Search β†’ Node.js Website β†’ Download Installer β†’ Install β†’ Verify in CMD

How to Install Node js

 

πŸƒ Step 2: Set Up MongoDB with MongoDB Atlas

MongoDB Atlas is a cloud version of MongoDB that we will use instead of a local installation. It’s reliable, scalable, and production-ready.

βœ… Installation Steps

  1. Search on Google:

    sh
    mongodb atlas

  1. Click the official link: https://www.mongodb.com/atlas

  2. From the top menu, go to Products β†’ MongoDB Atlas.

  3. Click Start Free and fill in the signup form (email, name, etc.). Then click Get Started.

πŸ—οΈ Set Up Your First Cluster

  1. Choose Free Tier (Shared Clusters) β†’ Click Create.

  2. Choose the following:

    • Cloud Provider: AWS

    • Region: Asia (Mumbai) – if you’re in India

  3. Name your cluster: e.g., test_mongodb

  4. Click Create Cluster

⚠️ This process may take 5–10 minutes.

🧩 Connecting to MongoDB Atlas

Once your cluster is created, follow these steps:

1. Whitelist Your IP Address

  • Click Connect

  • Choose Add My Current IP Address

    • To find your IP, just Google: what is my IP address

2. Create MongoDB User

  • Enter a username (e.g., testmongodb)

  • Set a password (choose something secure)

  • Save these credentials

3. Choose a Connection Method

  • Select β€œConnect Your Application”

  • MongoDB Atlas will provide a connection string

Example:

sh
mongodb+srv://testmongodb:<password>@cluster0.mongodb.net/

  • Replace <password> with your chosen password

πŸ“ Save this connection string. You’ll use it in your application code.

πŸ“Š Diagram: MongoDB Atlas Setup Flow
sh
MongoDB Atlas β†’ Create Cluster β†’ Whitelist IP β†’ Create User β†’ Get Connection String
Mongodb Atlas

βœ… Final Result

Congratulations! πŸŽ‰

You have now:

  • Installed Node.js

  • Created a cloud MongoDB database using MongoDB Atlas

  • Got the connection string needed to connect your app

 

Scroll to Top