Why Node.js is Ideal for the Internet of Things

Matt Robinson, Vice President, Technology, Progress Software
Jul. 31 2014, 03:05PM EDT

This article was prepared by a guest contributor to ProgrammableWeb. The opinions expressed in this article are the author's own and do not necessarily reflect the view of ProgrammableWeb or its editorial staff.

Technology never stands still, and smart companies have their ears to the ground to determine the next big thing and what they need to do to get ready for it. The Internet of Things is that next big thing, and Node.js will play a key role in ensuring that companies are ready and able to fully leverage it.

This is important because the Internet of Things, or IoT, will usher in significant challenges. Scalability, for one thing, will present a whole new hurdle. The sky is no longer the limit--data growth is essentially limitless. And when anything and everything begins to acquire intelligence and require data management, network control and design will need to change.

Indeed, the technologies involved in creating intelligent, connected systems are expansive, and it can be tough to know where to begin or what solution is best for a particular need. Most IoT products do not provide a unified experience between the business systems they need to communicate with and the embedded devices themselves.

Across all of these areas and more, application development will have to keep up. App dev must become more rapid, agile, and flexible than ever.

That’s where Node.js comes in. Several of the attributes that are making Node.js so popular make it well-suited for addressing the needs of IoT applications.

Rapid Growth

There has been a lot of talk lately about the rising popularity of Node.js, but no one expected it would grow this quickly.

Built on Google’s V8 open source JavaScript engine, Node.js is known for its speed, scalability and efficiency—making it great for developing data-intensive, real-time applications. This, of course, makes Node.js well-suited for the IoT, which is reliant on data-intensive, real-time devices and applications.

Further, effective and secure communications and interactivity are of paramount importance in the IoT, which is the very reason why APIs lend themselves so well to the IoT model. The single greatest and most widely accepted use case for Node.js is APIs. For example, the first thing LinkedIn built in Node.js was its mobile API.

There are many frameworks—including HapiExpress and Restify—designed for creating APIs in Node.js. Even without a powerful pre-built solution, however, it takes only a few lines of code to get an API started using Node.js.

Devices within the IoT, such as sensors, beacons and wearables, generate large floods of requests. Node.js is well-suited for managing these requests via streams that can be processed and monitored very efficiently. Stream instances are basically Unix pipes. They can be readable, writable or both, and are easy to work with. Streams allow users to pipe requests to each other, or stream data directly to its destination. No caching, no temporary data--just stream from one place to another.

It’s also important to note that the Node.js community has an affinity for IoT technologies, and early adopters of IoT have a tendency to use Node.js for experiments and products. In fact, the Node Packaged Modules (NPM) repository is an indicator of the association between these communities. It includes more than 80 packages for the Arduino controller, over 15 for Bluetooth Low Power, and multiple packages for the Pebble and Fitbit wearable devices.

In general, according to Module Counts, there were about 30,000 Node.js modules in NPM (the Node Packaged Modules repository) in 2013. For comparison’s sake, that’s about half of what Maven Central, the fastest growing and most successful of all Java repositories, had at the same time.

By the end of June 2014, the number of Node.js modules in NPM had grown to over 80,000 and surpassed Maven Central modules, putting NPM’s stake in the ground as the largest module repository in the world. If organizations weren’t convinced of the exponential growth of the Node community yet, this should prove it.

Node.js also has very low resource requirements, a feature that developers are already leveraging in data-intensive IoT scenarios. From wearables to M2M, Node.js sets itself up as an appropriate pairing for IoT. The bottom line is that developers building data-intensive, real-time IoT applications often find Node.js a natural fit.

Indeed, with its proven performance and the ease with which an API code base can be maintained, Node.js fits the IoT use case very well.

Here are some best practices to keep in mind when planning an API-first architecture for the IoT with Node.js:

  1. Write lots of tiny apps: Instead of putting a lot of logic into a single process, separate functionality into smaller independent components that talk to each other via APIs.
  2. Build in fine-grained scalability and failover: By writing lots of tiny API-First apps, you can independently scale out each functional component and gracefully fail-over when one instance goes down or crashes.
  3. Focus on producing a clean, extensible design: An API-based design makes state explicit so it can easily be passed from one component to another.

In order to effectively exploit the IoT—both as a consumer and as a producer—organizations must consider the products and processes that will enable them to be nimble and to build robust, secure solutions. Node.js is one tool that business and technology leaders can leverage to make sure they are leading, and not following, the IoT wave.

Matt Robinson Matt Robinson is Vice President, Technology at Progress Software.

Comments

Comments(8)

Matt56

Poor!

1) Node module count high  != Node is good for IoT

2) Node module count hi != Node modules good

3) Node module count hi != Node modules work

4) Generically listing some software practices that are used and applicable in several languages != Node is good or Node is appropriate for IoT

Sad Bunny

 

 

PWuser99

Re: your points 1-2, the article does not argue that Node module count equals anything other than participation in the Node community is growing which generally indicates more people are using it. It does not equate this to suitability for IoT or quality of modules. However, with maturity these things come, and with strong adoption comes maturity.

Re: point 4, the fact that these particular practices are not unique to Node does not make them less relevant or suitable for Node or IoT situations.

 

mario123

Very interesting article. My company has planned to incorporate node.js into our new applications. Now, some IT colleagues expressed their concerns as trained node.js developers are rare and we would need to recruit at least 4 full-time developers. Are their concerns realistic and justified? Thank you for any assessment of the current situation.  

PWuser99

I'm biased but would say the concern you mention is a bit exaggerated both on the rarity of Node developers and the size of workforce you would need to hire (but this is highly dependent on what are trying to build). In general Node.js does not require a deep skillset and can be learned very quickly by anyone experienced with JavaScript. As with any programming language, in Node if a developer has not had experience building scalable architectures previously he/she will be challenged. But experienced developers that already know JavaScript can learn and become productive in Node very quickly. A good place to start is:

http://blog.modulus.io/absolute-beginners-guide-to-nodejs