Best Modern Practices of Using Node.js

Many popular web services today require stability, scalability and fast server speed response in order to meet the needs of demanding customers. Thus Node.js comes in handy for developers as an effective runtime environment that helps to achieve these goals with Javascript.

Why more and more developers prefer Node.js over PHP? The first and foremost advantage of using Node.js is that it allows to use a single language for both front-end and back-end development. It’s Javascript, as you may already have guessed. Another thing that makes Node.js a desirable choice of technology is how effectively it handles multitasking. Executing tasks in parallel it doesn’t wait for one task to complete when starting another one unlike PHP. Overall performance of web apps that use Node.js is also significantly better than those developed in PHP.

Best practices for Node.js can be found all over the Internet, but let’s also look at some interesting examples of services that use Node.js that many of you definitely came across.  

Node.js Implementation at Uber

A leading on-demand delivery application and taxi ordering service Uber is a great instance of leveraging strong points of Node.js. Since the day Uber was founded it began to scale fast and thus required a reliable solution. Node.js helps to make the service work like a charm, as if it runs like water. 

Uber developers praise Node.js because it enables them to deploy new features and fix occurring errors on the go. This is beneficial for such a large service as Uber, because its developers don’t need to reboot any processes in order to fix errors. They benefit from the multitasking effectiveness that Node.js provides.  

Usage of Node.js at Netflix

Developers at Netflix had a serious dilemma of what technology to use for their fast-growing business of on-demand online video services. Taking into account that the majority of the UI they have developed so far (and continue to) is in Javascript, Netflix developers decided to go on working with it for server-side computations too. Initially Java and Objective-C were their primary languages used for the development of the Netflix service. However, having discovered the tremendous capabilities of the Node.js environment for scaling all the data access scripts, the choice became obvious.

So re-architecting the system and making the Node.js platform effectively running was of prime importance for the Netflix development team. Turning a multitude of scripts into Node.js apps helps developers to manage them more safely. And right now this major task is what Node.js programmers at Netflix are working on. 

Ebay’s Practice of Node.js

Node.js is also used by one of the top online marketplaces in the world – Ebay. Since many programmers choose Javascript nowadays, it was easy for Ebay developers to start working with Node.js. Why did they eventually decide to switch a part of their backend from Java to Node.js? Because they saw that contemporary web environments are built around this technology. Moreover, Node.js is suitable for such a large scale platform as Ebay and using numerous Node.js components is very common and easy for developers.

At Ebay their Node.js layer is responsible for Experience Services, a set of backend services that power Android and iOS mobile apps, as well as the website. Also eBay developers constantly build new tools to effectively deploy Node.js applications. 

How Adoriasoft uses Node.js

DriverAgent is one of those useful desktop tools that comes in handy when you need your system updated, running smooth and fast. What it does is that it effectively scans the system, locating outdated drivers and updates them automatically. Users thus don’t have to search for new drivers on the web anymore – the app does all the searching and installation for them instead. The DriverAgent utility is written mainly in PHP, with some Node.js parts added later.

But to what extent is Node.js being used in DriverAgent? The development team at Adoriasoft decided to use the PhantomJS module to achieve a part of the functionality needed for the efficient performance of the DriverAgent tool. In particular what we’ve developed is a crawler, which with the help of a headless PhantomJS browser visits all pages of the website. Then it gets the download links of all drivers needed. 

Why have we decided to use PhantomJS for the task, but not PHP, in which DriverAgent is written? In this instance PhantomJS made it possible to execute Javascript on pages for getting download links. PHP could not provide that, because it lets you work with the downloaded web page content as with text. Furthermore, choosing PhantomJS simplifies the processes as it can be executed with JQuery and other Javascript libraries. 

Wrapping up

Node.js is in many cases the first-choice technology and framework for large-scale modern apps and businesses that operate worldwide. Adoriasoft recognizes all the benefits of using Node.js, including asynchronous code execution, multitasking, fast processing, and its open source code nature. So for the majority of our web projects Node.js becomes the ideal technology solution that can help businesses to grow, scale and succeed.