Node.js Setup – Complete Beginner Guide (From Installation to First App)

Node.js Setup – Complete Beginner Guide (From Installation to First App)

Node.js is a powerful runtime that allows you to run JavaScript on the server side.

It is widely used for backend development, REST APIs, microservices, real-time applications, and tools like Angular, React, Camunda workers, and automation scripts.

This guide explains:
✔ What Node.js is
✔ How to install Node.js (Windows / macOS / Linux)
✔ How to verify installation
✔ Your first Node.js program
✔ npm basics
✔ Project structure and best practices


⭐ 1. What is Node.js?

Node.js is:

  • A JavaScript runtime built on Chrome’s V8 engine

  • Asynchronous and event-driven

  • Lightweight and highly scalable

Common use cases:

  • REST APIs

  • Backend for frontend (BFF)

  • Microservices

  • Real-time apps (chat, notifications)

  • Camunda 8 Job Workers

  • CLI tools


⭐ 2. Prerequisites

Before starting, you need:

  • A computer (Windows / macOS / Linux)

  • Internet connection

  • Basic knowledge of JavaScript

  • A code editor (VS Code recommended)


⭐ 3. Install Node.js

🔹 Step 1: Download Node.js

Go to the official website:
👉 https://nodejs.org

You will see two versions:

  • LTS (Recommended)

  • Current (Latest features)

👉 Always choose LTS for stability.


🔹 Step 2: Install on Your OS

🪟 Windows

  • Download the .msi installer

  • Click Next → Next → Install

  • Keep default options

🍎 macOS

  • Download the .pkg file

  • Open and follow installation steps

🐧 Linux (Ubuntu/Debian)

sudo apt update sudo apt install nodejs npm

⭐ 4. Verify Node.js Installation

After installation, open Terminal / Command Prompt and run:

node -v npm -v

Expected output:

v18.x.x 9.x.x

✔ Node.js is installed
✔ npm (Node Package Manager) is ready


⭐ 5. Your First Node.js Program (Hello World)

🔹 Step 1: Create a folder

mkdir nodejs-demo cd nodejs-demo

🔹 Step 2: Create a file app.js

console.log("Hello World from Node.js!");

🔹 Step 3: Run the program

node app.js

Output:

Hello World from Node.js!

🎉 Congratulations! Your first Node.js app is running.


⭐ 6. Understanding npm (Node Package Manager)

npm is used to:

  • Install libraries

  • Manage dependencies

  • Run scripts

Initialize a project:

npm init -y

This creates:

package.json

Example: Install Express.js

npm install express

Installed in:

node_modules/

⭐ 7. Simple HTTP Server Example (Express)

const express = require("express"); const app = express(); app.get("/", (req, res) => { res.send("Welcome to Node.js Server"); }); app.listen(3000, () => { console.log("Server running on port 3000"); });

Run:

node app.js

Open browser:
👉 http://localhost:3000


⭐ 8. Recommended Node.js Project Structure

nodejs-app/ │── app.js │── package.json │── package-lock.json │── node_modules/ │ ├── routes/ ├── controllers/ ├── services/ ├── config/ └── utils/

✔ Clean
✔ Scalable
✔ Enterprise-friendly


⭐ 9. Node.js in Enterprise & BPM Projects

Node.js is commonly used with:

  • Camunda 8 Job Workers

  • API Gateways

  • Workflow orchestration

  • Event-driven systems

  • Microservices architecture

Example:

  • Node.js worker subscribes to Camunda job

  • Executes logic

  • Completes job asynchronously


⭐ 10. Best Practices for Beginners

✔ Always use LTS version
✔ Use package.json scripts
✔ Do not commit node_modules
✔ Use .env for configuration
✔ Handle errors properly
✔ Keep code modular


⭐ 11. Common Mistakes to Avoid

❌ Forgetting to install npm
❌ Running Node.js files directly in browser
❌ Mixing frontend and backend logic
❌ Blocking code (avoid heavy sync loops)
❌ Not using version control (Git)


🎉 Conclusion

Node.js is:
✔ Easy to install
✔ Fast and scalable
✔ Perfect for backend and microservices
✔ Widely used with modern frameworks and BPM platforms

With this guide, you can:
👉 Install Node.js
👉 Run your first program
👉 Build APIs and services confidently


💼 Professional Support Available

If you are facing issues in real projects related to enterprise backend development or workflow automation, I provide paid consulting, production debugging, project support, and focused trainings.

Technologies covered include Java, Spring Boot, PL/SQL, Azure, and workflow automation (jBPM, Camunda BPM, RHPAM).

Comments

Popular posts from this blog

jBPM Installation Guide: Step by Step Setup

Scopes of Signal in jBPM

OOPs Concepts in Java | English | Object Oriented Programming Explained