What is Node.js? JavaScript on the Server Explained

Jatin VermaJatin Verma
4 min read

👋 Introduction

This blog is designed for beginners and for anyone curious about how Node.js works under the hood. While JavaScript was once confined to the browser, the rise of Node.js has made it a powerhouse on the server too. Let’s unpack what Node.js really is, how it works, and why it's a go-to choice for fast, scalable web applications.


⚙️ What is Node.js, Really?

Let’s start from the top.

At the heart of your Chrome browser is something called the V8 engine. It's what turns JavaScript into lightning-fast machine code. Someone had the crazy (brilliant) idea:

“What if we take that engine out of the browser and let it run standalone on a server?”

Pair that with libuv, a powerful library for handling file systems, networking, and more—and boom, Node.js was born.

Now, JavaScript isn't just for front-end developers anymore. It's running on servers in production environments at scale. And weirdly enough—it works beautifully.


🥊 Comparing with Traditional Backends

I get it—JavaScript is single-threaded. Compared to languages like PHP or Java, which are multi-threaded and take full advantage of all your CPU cores, Node.js can seem like a step backward.

But here's the twist.

Instead of spawning multiple threads, Node.js relies on asynchronous, non-blocking I/O. So when one operation (like a database call or file read) is in progress, the main thread doesn’t sit around twiddling its thumbs. It moves on. It keeps working.

Of course, there are trade-offs. You might need to run multiple instances of your Node.js app behind a load balancer to scale properly. But honestly, that's the norm in modern web architecture anyway.

And once you get used to it, writing backend logic in JavaScript feels like second nature—especially if you're already doing frontend work.


🍽️ Real-World Analogy: Node.js as a Restaurant Waiter

Here’s how I explain it to friends:

Imagine a single waiter working in a restaurant. Instead of taking one order, delivering it, and then coming back for the next, this waiter:

  • Takes all the orders quickly

  • Sends them to the kitchen

  • Delivers dishes as they’re ready

That’s Node.js.

It doesn’t wait. It listens. It delegates. It responds when things are ready. That’s what makes it non-blocking and ideal for high-performance apps.


🚀 Why Node.js is Perfect for Fast Web Apps

Over time, I found myself reaching for Node.js over and over—especially when performance and scalability mattered. Here's why:

✅ The Core Benefits

  1. Non-blocking, Event-Driven Architecture Handles thousands of simultaneous requests without freezing or crashing.

  2. Powered by Google’s V8 Engine JavaScript execution is fast—like really fast.

  3. JavaScript on Both Ends Frontend and backend use the same language, which cuts dev time in half and improves collaboration.

  4. Asynchronous by Nature Perfect for apps that do a lot of I/O operations—like APIs, file uploads, and database reads.

  5. Built for Real-Time Whether it’s a live chat, dashboard, or multiplayer game—Node.js delivers updates in real-time.


📱 Use Cases Where Node.js Shines

These are some of the projects where Node.js has made my life significantly easier:

  • Real-Time Chat Apps Built with WebSockets for fast, bi-directional messaging (think Slack or WhatsApp).

  • Collaborative Tools Like shared docs or whiteboards where multiple users interact in real time.

  • REST APIs and Microservices Fast to spin up and deploy. Services like PayPal and LinkedIn rely on Node.js for their backend APIs.


🛠️ Setting Up Your First Node.js App (Windows & Linux)

When I first tried setting up Node, I expected it to be complicated—but it wasn’t. In fact, it took me less than 5 minutes to run my first server.

🪟 Windows Setup

  1. Go to https://nodejs.org

  2. Download the LTS version.

  3. Run the installer and follow the prompts.

  4. Open Command Prompt and verify:

     node -v
     npm -v
    

🐧 Linux (Ubuntu/Debian)

curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
sudo apt-get install -y nodejs

Then verify:

node -v
npm -v

✨ Let’s Build a “Hello World” Server

Step 1: Create a folder

mkdir my-first-node-app
cd my-first-node-app
npm init -y

Step 2: Create app.js

const http = require("http");

const server = http.createServer((req, res) => {
  res.statusCode = 200;
  res.setHeader("Content-Type", "text/plain");
  res.end("Hello, world! This is Node.js.\n");
});

server.listen(3000, () => {
  console.log("Server running at http://localhost:3000/");
});

Step 3: Run it!

node app.js

Visit http://localhost:3000/ and boom—you’re a backend developer now.


💡 Want to Make It Easier? Add Express

Express is a super popular framework that simplifies routing and middleware.

npm install express

Replace your app.js with:

const express = require("express");
const app = express();

app.get("/", (req, res) => {
  res.send("Hello from Express!");
});

app.listen(3000, () => {
  console.log("Express server running at http://localhost:3000/");
});

✅ Final Thoughts

Learning Node.js wasn’t always smooth. At times, I wrestled with callbacks, misunderstood async behavior, and questioned why I wasn't using something “simpler.”

But the moment I saw real-time functionality just work—without writing a single line of threading code—I was hooked.

If you're building fast, scalable, and modern applications, Node.js is more than just a good option. It’s a powerful tool that makes backend development feel fun again.

0
Subscribe to my newsletter

Read articles from Jatin Verma directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Jatin Verma
Jatin Verma