Setting Up Your First Node.js Application Step-by-Step

Learning web development in public. Writing simple, real-world explanations about web development concepts. Helping beginners understand why things work, not just how.
Search for a command to run...

Learning web development in public. Writing simple, real-world explanations about web development concepts. Helping beginners understand why things work, not just how.
No comments yet. Be the first to comment.
Every day, millions of users upload photos, videos, stories, and reels to Instagram. From a user's perspective, the process appears simple: select media, apply filters, add a caption, and tap "Post."
Building Offline-First Messaging Apps: How Messages Work Without Internet Modern messaging applications have transformed the way people communicate. Whether it's chatting with friends, collaborating w
In this article we'll explore about the Expo Router and React Navigation and answer which one to use in 2026. If you build mobile apps using React Native, one thing becomes obvious very quickly: Navig

Modern mobile apps are no longer just a collection of screens connected together. Apps like Instagram, WhatsApp, Uber, and Netflix operate at massive scale with millions of users, real time systems, o
In this article we'll be exploring react.js and the things of react.js that makes it popular and stand out among other libraries ( no fight over library vs framework ). We'll go through: What problem

Shkaai
68 posts
Starting with Node.js for the first time can feel confusing, but the setup is actually very simple. In this guide, you will go step by step from installing Node.js to running your first server.
To begin, you need to install Node.js on your system.
Go to the official website: https://nodejs.org
Download the LTS (Long Term Support) version (recommended for beginners)
Run the installer and follow the default steps
The installation also includes npm (Node Package Manager), which is used to install libraries.
After installing, you should verify that Node.js is correctly installed.
Open your terminal or command prompt and run:
node -v
This will show the installed Node.js version.
Next, check npm:
npm -v
If both commands return versions, your setup is successful.
Node.js provides a built-in environment called REPL.
REPL stands for:
Read
Evaluate
Loop
It allows you to run JavaScript code directly in the terminal.
node
Now you can type JavaScript:
2 + 3
Output:
5
You can also try:
console.log("Hello from REPL");
To exit REPL:
.exit
REPL is useful for quick testing and learning.
Now let’s create your first Node.js program.
Create a new folder (for example: node-app)
Inside the folder, create a file named:
app.js
console.log("Hello, Node.js!");
To run your file, open terminal in the same folder and execute:
node app.js
Output:
Hello, Node.js!
This is your first Node.js program running successfully.
Now let’s create a simple server using Node.js.
Update your app.js file:
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");
});
Imports the built-in http module
Creates a server
Sends a response when a request comes
Starts listening on port 3000
node app.js
Now open your browser and go to:
http://localhost:3000
You will see:
Hello World from Node.js Server
You installed Node.js and npm on your system
Verified the installation using terminal commands
Learned how to use the REPL environment for quick experimentation
Created your first JavaScript file and executed it using Node
Built a basic HTTP server and understood how it responds to requests
Learned how Node.js runs outside the browser and can be used to create backend applications
By completing these steps, you have built a strong foundation in Node.js. You now understand how to set up the environment, run JavaScript outside the browser, and create a working server. This is the first step toward building real-world applications such as APIs, web servers, and full-stack projects. From here, you can start exploring frameworks like Express.js, working with databases, and building scalable backend systems.