Published on April 30, 2021
Numbers Don’t Lie
Let’s play a game called Truth or Dare. Not the middle-school sleepover variety, but one a group of CTOs might think is fun.
If you could use 33% fewer lines of code in an app that then loaded twice as fast, would you do it? For many Fortune 500 companies like PayPal, the answer was a no-brainer. Those are the exact stats PayPal measured when it made the switch to Node.js.
And PayPal isn’t alone. Netflix did the same and reduced its load times significantly. eBay created a live-chat app with Node.js. Countless start-ups have used Node as well. So what’s the deal? Why have companies large and small (and brand-new) adopted this technology? And should you follow suit?
The Magic Elixir
So how does Node.js act like a magician, shrinking code and letting videos stream faster? How does it keep pulling rabbits out of the hats of some of the world’s most dynamic companies?
No more writing code twice, once for the frontend and another time for the backend. Netflix engineers were doing this, at considerable expense of time and money, and decided to go with a fairly new solution in Node.js and it has never looked back.
Another plus is that Node, due to JS, has seen the growth of a thriving community of users. There is a library of 650,000 JS packages (modules) that Node developers can use, all housed in the Node Package Manager (npm). Since Node.js is open source and is built on Google Chrome V8, it is constantly being updated and improved with security patches and performance boosters.
A Single Thread
Node.js runs on a basic architecture that is single-threaded and event-based, and these features allow it to handle up to a million concurrent connections. In practical terms, Node excels in any kind of “real-time” application such as chats or streaming. Maintaining a live connection to a server is what eBay wanted in its Talk feature—in addition to deploying other services in an I/O framework. Node.js was the perfect solution.
With Node.js, you can take the idea of “cross-functional” teams one step further by chunking the app into smaller units called microservices. That way, you can set up separate teams that work on just a portion of the code. Each microservice can be tested separately or even written in a different coding language. You can outsource certain portions and keep others in-house because the microservice approach is scalable in many agile ways.
These nimble teams are easier to work with compared to overhauling the entire codebase whenever you implement changes. One example might involve a digital marketing company that is much more concerned with content management and chat than with email. The microservice approach offered through Node.js lets small teams handle just the parts of the app that need attention if the other parts are operating efficiently. Without Node.js, adjusting one part meant diving into the entire code, which is laborious and unnecessary.
It’s Not Perfect
But keep in mind that Node.js isn’t the right magician for every birthday party. If your app is a simple CRUD app—meaning it Creates, Reads, Updates, and Deletes—then Node is completely overkill and most of its power will be wasted.
This is why you want to consult with those who know before making a decision. We’ve worked with Node.js on many projects, and we’ve also steered clients to other solutions. We never take a “one-size-fits-all” approach and would love to discuss your options with you. Without a doubt, Node.js is a dynamic tool and a game-changer in many important ways.
This post was last updated on May 20, 2021