Airbnb, LinkedIn, Walmart, Uber, and even NASA (!) have used Node.js in production. Many smaller enterprises and startups follow their lead and leverage the technology in building applications. The benefits of Node.js are countless, but you should also be aware of its constraints. Get a full picture of Node.js and avoid making serious mistakes in development that could cost you money.
Netguru builds digital products that let people do things differently. Share your challenge with our team and we'll work with you to deliver a revolutionary digital product. Create a product with Netguru.
Node.js is a good choice for applications that have to process a high volume of short messages requiring low latency. Such systems are called real-time applications (RTAs), and they can be easily developed with Node.js. Thanks to its specifications, Node.js will be a good choice for the real-time collaborative drawing/editing-type apps, where you can watch the document being modified live by someone else (such as Trello, Dropbox Paper or Google Docs).
The list of RTAs that can be effortlessly developed with Node.js is much longer. One of the most popular ones are live-chat and instant-messaging apps. Node will also be the right choice, if you want to create a video conference app that will work with specific hardware or VoIP. Additionally, you might want to consider Node.js for online gaming apps or e-commerce transaction software, where online data is of much importance.
Node.js is very efficient with real-time applications: it facilitates handling multiple client requests, enables sharing and reusing packages of library code, and the data sync between the client and server happens very fast.
Ruby on Rails might not be sufficient in terms of speed, if you have a ton of requests. Node.js will prove useful in situations when something faster and more scalable than Rails is needed. Node’s ability to process many requests with low response times, as well as sharing things such as validation code between the client and server, make it a great fit for modern web applications that carry out lots of processing on the client’s side. For these reasons, Node.js is a popular choice among "single-page application" sites, where all the rendering is done on the client’s side, and the backend only provides a JSON API.
Node.js also comes in handy, when you want to process high volumes of IO-bound requests. It won't really be all that efficient if a lot of CPU processing is required to serve the request. Yet, if it's primarily just shuffling data around, then it will be quite efficient, because a single instance can serve a lot more requests with the same hardware, compared to the usual "thick" application server (like with rails).
Even though Node.js is – in many cases – the perfect fit for building applications, there are still some bad use cases when you shouldn't consider using it.
The first thing that comes to my mind are heavy-computing apps. Node.js is based on an event-driven, non-blocking I/O model, and uses only a single CPU core. CPU-heavy operations will just block incoming requests, rendering the biggest advantage of Node.js useless. If you are considering building CPU-heavy software, try a different, more suitable, technology that will give you better results.
Finally, using Node.js would be superfluous for simple HTML or CRUD applications in which you don't need a separate API, and all data comes directly from the server. Your application might be marginally more scalable, but don't expect more traffic coming to your app just because you used Node.js. In such cases, you should stick to such proven frameworks as Ruby.
There are more things to consider before kicking off with Node.js. Many packages for Node.js applications are available in npm. The community is vibrant, the technology is becoming more mature, and npm is the largest available repository at the moment. Yet, packages vary in their quality. Sometimes, you can still encounter issues with packages supported only by individual users and not maintained properly; for instance, when connecting your Node app to an obscure or old database system.
First of all, go to the official web page of Node.js (nodejs.org) and download the Node.js package. Later on, we need to install the Node.js package manager to install and manage the dependencies in our project easily. Visit npmjs.com and follow the installation instructions. Now, we are ready to write some code.
The best starting point for the Node.js is the official guide, from which you can learn the core concepts of Node.js. In the Node.js guide, you can find the answer to one of the most important questions: How to build a simple Node.js server?
After that, you will be ready to learn by building your own applications.
Both Rails and Node can achieve the same results. However, there are different situations where each one works best. With Rails, you can prototype and move fast, break things, and get a crude app in an hour. Node, on the other hand, requires more resources, but it scales better, works great with real-time tasks and is faster overall. Hopefully, the tips above will help you pick the best technology for your project. If you want to learn more about the advantages and disadvantages of Node.js check out our article!