Skip to main content

Command Palette

Search for a command to run...

Setting Up Your First Node.js Application

Updated
2 min read
Setting Up Your First Node.js Application
V
Blog on different tools and technology or concept that useful for the begineer that start their jouney in software industry

Starting backend development can feel overwhelming — servers, APIs, databases… where do you even begin?

The good news? You don’t need complex frameworks to get started. With just Node.js, you can build your first server in minutes.

In this guide, we’ll go step-by-step — from installation to running your very first Node.js application.


Installing Node.js

Node.js is a JavaScript runtime that allows you to run JavaScript outside the browser.

Steps:

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

  2. Download the LTS (Long Term Support) version

  3. Install it like any normal software (Next → Next → Finish)

✔ Works on Windows, Linux, and macOS — no special setup required.


Checking Installation Using Terminal

Once installed, verify it using your terminal or command prompt.

node -v

You should see something like:

v20.x.x

Also check npm (Node Package Manager):

npm -v

If both commands work, your setup is successful.


Understanding the Node REPL

Before writing files, let’s understand something powerful — REPL.

What is REPL?

REPL stands for:

Read – takes input

Eval – executes it

Print – shows output

Loop – repeats

It’s like a quick playground to test JavaScript directly in your terminal.

Start REPL:

>node

Example:

>5+2
>7
>console.log("Practice javascript")
>"Practice javascript"

To exit:

.exit

Creating Your First JavaScript File

Now let’s write actual code.

  1. Create a file:

  2. Add this code:

console.log("Hello, Node.js!");

Writing Your First “Hello World” Server

Now let’s build something more interesting — a basic server.

Code-

const http = require("http");

const server = http.createServer((req, res) => {
    res.end("Hello World from Node.js Server!");
});

server.listen(3000, () => {
    console.log("Server is running on port 3000");
});

Run the server:

node index.js

Now open your browser and visit:

http://localhost:3000

You’ll see:

Congratulations — you just created your first backend server without any framework.


Conclusion

You’ve just completed your first step into backend development:

✔ Installed Node.js
✔ Verified setup
✔ Explored REPL
✔ Ran your first script
✔ Built a basic server

This might look small, but it’s the foundation of everything ahead — APIs, databases, authentication, and full-stack apps.