Bringing Node.js into your project: pros and cons

Walter Conant
Custom description
July 12, 2017

Introduction

Node.js is a platform built on Chrome’s JavaScript runtime for easily building fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices.

This is what official Node.js website tells us, and this is where we suggest you to start learning Node.js.

A couple of years ago Elinext team made a decision to experiment with Node.js, and today we feel like it’s time to share our impressions with you.

The first question that emerged in the heads of our developers is “what exactly is Node.js?” They wouldn’t call it neither Javascript language implementation, nor its library, nor a framework, nor a web server. While diving deeper into the topic, we came across such notions as “environment” or “runtime”. Some resource suggested a brief description of Node.js as an “event loop featured by libraries”.

Frankly speaking, our developers weren’t quite satisfied with these definitions, and least of all we wanted to work with a black box. That’s why we dug into a source code, standard library, and libuv library where all the asynchronous and nonblocking primitives were implemented.

Digging deeper: Node.js applications

The next step was to study all the applied libraries and tools. This allowed our team to understand how to work with Node.js and get outside of its strengths and weaknesses.

It turned out that there is no universal web framework that Node.js community concentrates on. We discovered some well-elaborated and powerful frameworks, and here are our favourites:

Express.js, known as a part of a popular MEAN stack, was probably the most efficient of the frameworks we tested. Our team was impressed by clearly arranged documentation, in comparison with Node.js documentation in general. The main benefits of Express.js lie in its routing capabilities, easy configuration and customization, and middleware modules that allow you to perform additional tasks on request and response.

Hapi.js. is very similar to Express.js, as it provides API for building HTTP servers in Node.js. However, Hapi.js is prominent for its rich set of features and plugins, while Express.js offers fewer out-of-the-box functionality. With that in mind, Hapi.js can cover a wider range of use cases which makes it a better fit for large-scale projects.

Koa.js has proven to be great fit for web applications and APIs. Our attention was drawn by generators Koa.js uses to work with callbacks and error-handling, thus making the application more readable.

Node.js: Pros and Cons

Well, what’s so special about Node.js? Having worked with this technology on a range of projects, we formed our own list of advantages and disadvantages that come with it. Let us share some.

Pros

  • Javascript. Node.js uses single programming language – JavaScript. It is easy to learn and allows developers to use the runtime environment for both frontend and backend in JavaScript, without using any server-side programming language.
  • Microservices architecture. The platform is fast and highly scalable, as it consists of microservices that can be built on top of the existing solutions as well as integrated with one another. This means that you can break the whole project into small modules which are independent, though tightly coupled with one another.
Microservices architecture
Node package manager (NMP)
  • Asynchronous non-blocking code. Using Node.js, you benefit from asynchronous non-blocking code, as resources are consumed by web servers more economically, so that they can support more parallel client connections for the applications where input-output operations are run. We would say that the implementation of such a code is comparatively good as it is in Ruby, Java, or Python.
  • Node package manager. You can enrich existing ecosystem with npm – free and open-source package manager for Node.js featuring free tools and libraries which are being actively developed and enhanced.

Cons

  • No basic libraries or tools. Each of the applications has a lot of alternatives which makes it harder to choose a right stack. The only possible way we see is to check and choose between a plenty of them, as often applied documentation doesn’t offer a comprehensive picture of advantages and disadvantages.
  • Poor for relational data access. Although some relational databases, such as PostgreSQL or RethinkDB seem to work better for Node.js applications with each release, their support in Node.js is still underdeveloped.
  • Unsuitable for heavy processing. When it comes to CPU intensive operation and the thread is occupied with heavy computation, Node.js benefits of non-blocking I/O model melt away, as all the incoming requests are being blocked.
  • Multithreading is not supported. That’s why many developers consider the technology unsuitable for complicated web applications. However, our experience shows that it can be used as efficiently as php for large-scale projects when clustering multiple Node.js processes. Simply put, to have multiple threads, you need to run multiple processes as well.

Node.js: Elinext choice

Apparently, Node.js is not a one-size-fits-all solution for web development, however, none of the popular technology is. For a standard web application which actively exploits database and requires good speed and scalable architecture, it surely can bring significant performance increase.

This works well for many of Elinext projects featuring social network, IoT solutions, chats, video streaming apps and e-learning solutions where the speed and intensive data management mattered much.

Our switch to Node.js in a range of projects was fast and smooth, with a low learning curve. The main pitfalls emerged on the way of selecting the right libraries, studying them and comparing them with one another. Our main focus now is on the integration of multiple Node.js tools, their completion and future enhancements.

RELATED ARTICLES

Top Questions and Answers about CRM

Growing businesses are looking for a better way to manage customer relations. Understanding that the idea to store their information in note cards or Google documents is a bit old-fashioned, they are wondering, what is CRM, how it works and how it can help their businesses. These questions are hardly...
READ ARTICLE
top technologies in real estate

5 Cutting Edge Technologies That Will Transform Real Estate Business

New technologies strike like lightning.  The willingness to keep up with the new trends is no longer a prerogative of big companies, with ever more small businesses trying to bring technology to their business models. For real estate industry, this may seem like a challenge, as their workflow hasn't changed...
READ ARTICLE
How to start software development project

The Ultimate Guide to Hiring Developers for Your Project

Sometimes choosing a developer is as simple as asking a fellow business whom they use in their projects. However, other times you have to go through selection routines. Your main objective must be to create your own list of suitable developers, which conforms with your needs, and then reduce this...
READ ARTICLE

QR Code Solution for Mobile Devices

Business Needs High level of competition in business creates needs to provide as much services as possible for less money. Companies try to inform clients as much as possible about the opportunities and competitive advantages. Large spaces of printed surfaces are used to show the content marketing information. The tendency…

READ ARTICLE