paint-brush
Why You Should Build Your Web App on Node.jsby@ashish-parmar
681 reads
681 reads

Why You Should Build Your Web App on Node.js

by Ashish ParmarNovember 24th, 2019
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

Node.js is not actually a platform or a framework but it is a run-time environment which is based on Chrome’s V8 JavaScript. The V8 engine of Google is what provides Nodejs its speed, as the event loop of Node.JS does not form separate threads and uses a single thread which helps in boosting speed by allowing. The number of dynamic tools and modules in the NPM now surpass 475,000 with more than 11,000 new modules and tools being added on a weekly basis.

Companies Mentioned

Mention Thumbnail
Mention Thumbnail
featured image - Why You Should Build Your Web App on Node.js
Ashish Parmar HackerNoon profile picture

Successful startups such as Uber, Walmart, and Netflix are immensely popular in their respective genre. Apart from being successful, they have one common string that connects them.

All of these companies have used Node.js at some or other point in their journey towards success.

Introduced way back in 2009 by Ryan Dahl in the annual European Jsconf, the Node.js is not actually a platform or a framework but it is a run-time environment which is based on Chrome’s V8 JavaScript.

Node.js is growing, and it is growing fast as is evident from the NodeJS quarterly downloads graph below:

(Image Courtesy)

Let’s explore the benefits of building your website with Node.js

Need for speed

Building websites and applications with Node.js is fast. The V8 engine of Google is what provides Node.js its speed, as the V8 engine uses JavaScript into native machine code. The asynchronous I/O operations are taken care by the event loop of Node.js and Node.js does not form separate threads and uses a single thread which helps in boosting speed by allowing Node.js to handle multiple connections simultaneously.

While the other web platforms start a separate thread for each new request which eats up valuable processing power making the process slow.

Actions, like writing to or reading from a database, file system or network connections, are performed at a faster pace by Node.js. There have been numerous examples of companies benefiting from using Node.js; some famous ones are of LinkedIn and PayPal.

LinkedIn chose Node.js for handling their mobile traffic. This resulted in a 10-fold reduction in the number of servers, from 30 to 3. Apart from this, the application was 20 times faster than before. Now that’s what you call a double whammy!

PayPal doubled requests it could handle per second while reducing 35% of its loading time.

High Scalability

Node.js applications are scalable as they employ features like cluster module, which empower in balancing the load over multiple CPU cores.

Websites developed in Node.js are highly scalable, in both horizontal as well as vertical directions. Developers can add nodes to the existing systems to scale up in a horizontal manner, while the vertical scaling of the application is possible by adding extra resources to single nodes.

This feature of high scalability puts Node.js at an advantage over other JavaScript-based servers. Node.js is a lean technology tool which fits well in the micro services architecture. In Node.js the code is broken into small modules, the developers can easily add more modules into the existing code.

Easy to learn

Node.js uses JavaScript which is a popular programming language in which most of the front-end developers are well versed. This reduces the learning curve of these front-end developers and helps them in learning the back-end side of Node.js easily.

Node.js allows you to share the same language both on server and client sides. Removing the necessity of continuously switching from back-end to front-end sides, the Node.js thus reduces the number of developers required thus eliminating a substantial amount of costs in the process.

Using Node.js, PayPal built its application with half the number of people normally required to complete a project. The project time and subsequently cost reduced and hence the efficiency of developers increased with Node.js.

NPM and good supportive community

Node.js has an ace up its sleeve called the NPM(node package manager), which allows the developers to utilize the power of small modules of codes. The developers do not need to write from scratch a few common features and can use the modules from NPM.

The number of dynamic tools and modules in the NPM now surpass 475,000 with more than 11,000 new modules and tools being added on a weekly basis. There is a wide supportive community of developers who aid in the development of Node.js by contributing tools and modules into the NPM. The time to market of the application is drastically reduced when the developer does not have to invent the wheel all over again for common applications.

To provide community support a Node.js foundation was established in 2015 which has Microsoft, IBM, Fidelity, and SAP as its founding members. With the industry heavyweights backing Node.js, it is safe to say that the tool is here to stay.

Addressing the security and privacy concerns, Node.js released the enterprise version of its package manager.

Cost-effective

Node.js is an open-source tool. Also due to its modular nature, it is easier and faster to build a web application on Node.js as compared to other platforms. This makes Node.js a cost-effective platform.

Build real-time applications faster with Node.js

With Node.js building real-time web applications has become lightning fast. Developers can build these applications with ease and simplicity, which can be compared to building a simple blog in PHP. Multi-user apps such as games and chat can be made easily in Node.js. Real-time data syncing is possible with Node.js as it holds both backend and frontend of the application in sync.

Data Streaming

In e-commerce platforms, there used to be a lag time because the server requests and responses were considered as different events. Node.js has eliminated this by combining both requests and responses in a single data stream. As applications become more and more data-intensive by imbibing features such as videos and rich animations it has become necessary to reduce the lag time, a feat easily achieved by Node.js.

Node.js gels well with Microservices Pattern

As you might be familiar when you build your MVP it is a basic Web app with only the necessary features. As the web app grows, so does its complexity. A time comes when the web app becomes too complex and it becomes a headache for the developers to make changes into it. Imagine a situation where your company has built a marketing app which has various components like CMS, reporting and email marketing.

As you know, a few features of the app (any app for that matter!) are used predominantly by the users while ignoring the others. In this case, it is highly likely that your app users utilize the CMS function more than the other two functions.

Hence it would be a wise decision to scale up only the CMS part of the application by assigning more computing power to it. The thing is, that it is very difficult to adopt this kind of approach with monolithic apps and you will need to scale up the whole thing leading to un-necessary allocation of resources adding up to the cost of developing the app.

It becomes to co-ordinate between team members when the entire app is scaled up. This problem can be solved by using a microservices pattern. In this kind of pattern, the app is divided into many small parts known as microservices.

These parts are able to sustain themselves independently, so much that all these parts can be developed separately by different teams in different geographies! For example, while one part is being developed in North America, the other could be developed in India while the third in Ukraine!

Node.js gels well with the microservices pattern and companies like PayPal, Godaddy, and Netflix have deployed Node.js and the microservices pattern in combination to achieve better efficiency with less code.

With Node.js development of web apps is being ushered into a new era. Node.js is the go-to tool for developing data-intensive, real-time web apps with less number of developers in a cost-effective manner. These web apps built with Node.js can handle multiple queries simultaneously without much fuss.