A company came to us because its new API stalled under load while the server sat nearly idle. One synchronous file read was blocking every other request, and nobody on the team had been shown what Node.js does with a request. The cause took us ten minutes to find. Most guides stop at 'it runs JavaScript on the server' or bury you in event-loop theory.
We've seen that teams who know the runtime from the get-go run faster and debug less during their 150+ client engagements across 30+ industries. A simple description, a clear understanding of what Node is and a running web server on localhost:3000 using only core modules and copy/pasted code.
What Is Node.js?
Node.js is an open-source, cross-platform JavaScript runtime built on Google Chrome’s V8 engine. It allows JavaScript to run outside the web browser, providing access to the file system, networks, and operating system. Unlike frameworks such as Express, Node.js is a runtime that can be compared with alternatives such as Deno and Bun.
.webp)
Node.js Explained in Plain Terms
- It was developed by Ryan Dahl in 2009 and is now maintained by the OpenJS Foundation.
- npm provides millions of packages that can be reused.
- One language is used for client side code, and the server side applications.
That's the single hiring pool for a business instead of two. To a developer, validation logic is the same in the browser and on the server. According to Stack Overflow's 2024 Developer Survey, Node.js is the most popular web technology, being used by about 40% of developers. JavaScript is the most popular language used by GitHub's Octoverse.
Where do UI and UX design fit? Not here. Your front-end team designs, and Node.js serves what they build, including web components.
What Is Node.js Used For?
- APIs and microservices: backbone of server side applications and high traffic websites.
- Real-time Apps: Real-time chat applications, live dashboards and notifications.
- Scripts and data jobs, command-line tools and build tools.
- Hardware control: IoT prototypes driven by the Node.js for driving sensors and boards.
Not much use for CPU-intensive tasks, like video encoding. Choose it when it is a significant part of the waiting time.
How Does Node.js Work?
Many connections, just one main thread – that's what Node.js does. Event Driven Programming: Code responds to events, rather than waits for them.
The V8 Engine and the Node.js Runtime
V8 is executing your code, and libuv waits on the slow things. That takes three pieces to do.
- The V8 JavaScript engine compiles your code to machine code.
- The file, network and OS access that browsers withhold is added to Node.js.
- The asynchronous I/O primitives are provided by libuv, a C library, and thus slow reads and network operations are executed outside of the main thread.
Event Loop and Non-Blocking I/O
Picture a waiter who takes your order, passes it to the kitchen and moves to the next table. It's non-blocking I/O, the waiter is the event loop.
console.log('Start');
setTimeout(() => console.log('Delayed callback'), 1000);
console.log('End');
// Output order: Start, End, Delayed callback
'End' prints first because Node.js does not pause for the timer. Here is what most guides get wrong: Your JavaScript runs on one thread, but libuv keeps a background thread pool (four threads by default). So Node.js is single-threaded where that costs least. Not always, though: One CPU-heavy loop still freezes every request, which is what hit that first company.
.webp)
How to Install Node.js
Use nodejs.org's LTS release since it provides for long-term support and security patches. It is the first place for everyone to begin. For developers managing multiple Node.js versions, see our guide to installing Node.js with NVM.
Install Node.js on Mac, Windows, and Linux
- Mac and Windows: Click the download link to download the official installer. Install Node.js on Mac by using Homebrew: brew install node.
- On Linux: Use your package manager or the instructions from nodejs.org, as default repositories may contain older releases.
It is not an additional download, as npm installs with Node.js. Set up time: Approximately 10 minutes.
Check Your Version and Update Node.js to the Latest Version
node -v # prints your Node.js version
npm -v # prints your npm version
Both commands should print a version number. Node.js releases follow a regular release cycle, with major versions progressing through a Current phase before entering LTS. Choose an LTS release for production use and check the official release schedule for current version information. If you need to update Node.js, re-run the installer or use nvm when managing multiple projects.
Build a Simple Node.js Server Step by Step
The whole server is about 10 lines and uses only built-in modules.
Step 1: Create Your Project Folder
mkdir my-node-server
cd my-node-server
npm init -y
npm init -y creates package.json, which stores your project's name, version and dependencies as key-value pairs. Every Node.js project has one.
Step 2: Write the Server Code with the HTTP Module
const http = require('http');
const server = http.createServer((req, res) => {
res.statusCode = 200;
res.setHeader('Content-Type', 'text/plain');
res.end('Hello from Node.js\n');
});
server.listen(3000, () => {
console.log('Server running at http://localhost:3000');
});
- require('http') loads the built-in module for HTTP servers.
- createServer runs your function for every request, with req as the request and res as the response.
- res is a Writable stream, so res.end sends the body and closes it.
- listen(3000) binds the web server to port 3000.
There are two modules systems in Node.js. We are using CommonJS modules (require) because they don't require any set up. To use ECMAScript modules (import) you simply need to add "type": "module" to package.json.
Step 3: Run the Server and Test It in Your Browser
Start node server.js and open the web browser and navigate to http://localhost:3000. The server should be responding, you should be able to see 'Hello from Node.js'. Test non-browsed using curl. This will take about 5 minutes to construct.
curl http://localhost:3000A misrun is typically a minor error. Review these three points:
- Another process: 3000 is running in the port.
- You have the following error: Wrong directory: Run ls and check if the server.js is present.
- No restart: Node.js won't restart on edits. Copy and re-run.
Step 4: Handle HTTP Methods and a 404
Real servers use HTTP methods to indicate what action should be performed on a resource. When building a Node.js server or REST API, choose the method based on the operation the client wants to perform:
- GET – Read data: Use GET to retrieve an existing resource without changing it. For example, GET /users could return a list of users, while GET /users/123 could retrieve a specific user.
- POST – Create data: Use POST to submit data and create a new resource. For example, POST /users could create a new user using the information provided in the request body.
- PUT – Replace data: Use PUT to completely replace an existing resource with the data supplied in the request. For example, PUT /users/123 could replace the details of user 123.
- DELETE – Remove data: Use DELETE to remove an existing resource. For example, DELETE /users/123 could delete user 123.
Using the correct HTTP method makes an API easier to understand and gives clients a consistent way to interact with server-side resources.
const server = http.createServer((req, res) => {
if (req.method === 'GET' && req.url === '/') {
res.setHeader('Content-Type', 'text/html');
return res.end('<h1>Hello</h1>');
}
if (req.method === 'POST' && req.url === '/echo') {
let body = '';
req.on('data', (chunk) => (body += chunk));
return req.on('end', () => res.end(body));
}
res.statusCode = 404; // unknown route
res.end('Not found');
});
Request headers are received as key/value pairs in the req.headers object. Request data is returned in blocks which you build up as above. If there are none, then an HTTP 404 is returned. Never place request data into a SQL statement. Use parameterised queries.
Step 5: Serve Files Safely
For static file serving, move this functionality into the Express section instead of implementing it manually with Node.js's fs and path modules. Express provides documented middleware for serving files from a public directory:
const path = require('node:path');
app.use(express.static(path.join(__dirname, 'public')));
This approach serves static files such as HTML, CSS, JavaScript, and images directly from the public directory and keeps the server code simpler. The manual path-traversal protection and fs.createReadStream() implementation can therefore be removed from this section.
This is where most teams move beyond the basic Node.js runtime and start using a web framework such as Express for customer-facing applications.
Node.js Development: What to Build Next
Node.js development in production usually means the Express web framework, or Fastify, on top of the http module. Hand-rolled routing means rebuilding what Express ships on day one.
Our Take: Learn raw http for an afternoon, then use Express or Fastify for anything customer-facing. Hand-rolled routers are where technical debt starts.
Which one fits your team?
1. Learning or a throwaway prototype? Raw http module.
2. Building routes, middleware and a REST API? Express.
3. Facing a launch date with no spare Node.js hands? Bring in a team.
Building a REST API with Express
A set of URLs that let programs read and write data over HTTP. Install Express.js, then add one route.
npm install expressconst express = require('express');
const app = express();
app.get('/', (req, res) => res.json({ message: 'Hello from Express' }));
app.listen(3000);
Four lines, one working endpoint. Add validation and authentication before real traffic. The Express documentation covers routing and middleware, and our guide to integrating the Claude API into enterprise applications shows a deeper backend example. Build time: About 10 minutes.
Run Your Node.js App in a Docker Container
A service written in Node.JS for a healthcare client crashed on the fourth laptop for this client because it was using a different version of Node.JS. Using Docker the app runs uniformly across the different environments.
.webp)
Docker Image vs Docker Container
A read-only blueprint with your code, Node.js and dependencies. A running instance of this blueprint is a container, and you can use docker images to list the images in your local system.
Using docker run to Start Your Server
Add a Dockerfile beside server.js, then build the image and start a container with two commands.
FROM node:lts
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
EXPOSE 3000
CMD ["node", "server.js"]
docker build -t my-node-server .
docker run -p 3000:3000 my-node-server
- docker build creates the image.
- docker run -p 3000:3000 starts a container and maps its port to yours.
- In production, pin an exact tag instead of lts.
Push the image to any cloud platform, such as Google Cloud Run. Docker's install docs cover setup, and our cloud migration team handles containerised deployment at scale. For a broader look at Docker and containerization, see Top Containerization Technologies in 2026.
Get Node.js Development Services with BNXT.ai
BuildNexTech ships production Node.js systems. Bring in a team when a prototype becomes a commitment:
- A prototype heading for production.
- A version upgrade.
- A missing skill set.
Our AI conversion system doubled lead conversion for a real estate platform with 180K+ monthly leads. Not every project runs on Node.js, and we say so when another stack fits better.
Worried your domain is too specific? We have delivered across 30+ industries. Larger firms such as Accenture or Globant suit programme-scale transformations. If you need to hire a Node.js developer for one API, or hire Node.js developers for a full product, our Node.js app development services fit that scale.
What Working with a BNXT.ai Node.js Team Looks Like
- Discovery: Mapping of Requirements, Integrations and Risks.
- Build: We release things in small chunks you can look at.
- Deploy: Containerise the app and configure the pipeline.
- Monitor and iterate: It is monitored and iterated after the launch.
Your code, documentation and deployment pipeline belong to you when it is handed off.
"Node.js is not a language or a framework. It is a runtime, and that one word explains most of what confuses beginners."
.webp)
Conclusion
With one language to support both the server and browser, and the event loop is what enables a few lines to support many connections, Node.js is an intriguing idea. You now have a server up and running, a container and a safer file route for your learning experience with Node.js!
We have been rated 4.3 on Trustindex by our clients like Emirates, Paytm and Skechers and by teams which have worked with BuildNexTech. The hard part is year two – who will maintain the server? Teams that “forget” to take it, are just paying later.
People Also Ask
REST API vs SOAP: Which fits a Node.js project?
Since REST is based on only light-weight JSON over HTTP, it is suitable for most Node.js projects. For legacy enterprise integration where strict contracts and standards are required, SOAP is a good choice, such as banking and insurance systems.
How do I install Docker on Ubuntu?
Install the official apt repository of Docker, install the docker-ce packages and test the installation by running the hello-world image. The exact commands for each Ubuntu release are described on the Docker's documentation.
What should I look for in a Node.js development company?
Try to find production examples using Node.js, a clear hand-off (code, docs, pipeline), and sincere guidance on when it would be better to use another stack. Request an applicable case study.
How do I keep a Node.js app running after a crash?
Use a process manager like PM2 (or use a restart policy for your Docker container). Make sure you record all errors as well, as they will be masked when the computer restarts automatically.
Can Node.js work with databases such as PostgreSQL or MongoDB?
Node.js supports databases such as PostgreSQL and MongoDB through official drivers and npm packages. You can also use ORMs or ODMs such as Prisma and Mongoose. Use parameterised queries to ensure user input is not passed directly into the database as SQL, helping prevent SQL injection. For examples of how Node.js fits into modern application stacks, see our Web App Tech Stack Guide.




%201.webp)

%201.webp)













.webp)

.png)
.png)



.webp)
.webp)
.webp)

