Node.js: One Language to Rule Them All?

   Back to list

When I started my adventure with programming, I couldn’t understand why there were so many paths to choose from, even with my limited knowledge of programming languages and frameworks. The possibility of creating games was what pushed me into programming, so I went for Java (I also didn’t know about Unity either).

After hours of blood, sweat, and tears, I created my first RPG with 2 NPCs, one player, a simple map, 4 dialogs and a few actions. Realizing this was not worth it, I gave up and started searching for a simpler way. When I discovered Processing, I fell in love with it; everything was so much simpler. I could make similar things in the browser window using P5.js with very few syntax changes.

This euphoria lasted until I tried to create my first ‘serious’ app. I was aiming to simulate a wind effect on a map of Poland using real data from weather stations with P5.js. The end result was to create thousands of particles flowing across a map, leaving traces and drawing wind movement, something a little like this. After some experimentation, I discovered my method made it terribly laggy and slow. I didn’t have enough skills to optimize it any better, so again I gave up. I started to focus more on optimizing my code and gaining more understanding. There are two basic ways: either it’s simple or it’s fast.

  • You can use jQuery to hastily prototype website, but it won’t be as fast as pure Javascript version.
  • You can use Processing, but it won’t be as fast as Java.
  • You can use Node.js, but it won’t be as fast as Go or Rust.
sourcesecsmemgzbusyCPU load
Rust3.15159,21275611.5387% 92% 88% 100%
Go25.25374,780101387.6587% 88% 86% 86%
Node.js28.93892,35299496.1684% 81% 82% 85%

Binary-tree benchmark via Benchmarks Game

So why even bother?

So why is everyone so hyped about Node? The example above may not apply in reality, but it still demonstrates that Rust can be as much as 9 times faster than Node!

With the introduction of Node Javascript, we gained one powerful weapon – versatility. It’s hard, or maybe even impossible, to find a language in which you can write in so many different ways with such ease. Will it become the one language to rule them all?

With its huge community and brilliant package tool, Node is developing at an outstanding rate. Their most recent package registered sales of NPM in excess of one million!

Last year chart via Medium

Examples of what you can do with Javascript in 2019

Here are few examples showing what you can do with Javascript in 2019.

1. Embedded

Yes, it’s true. You can write programs for microcontrollers (ESP32-WROVER) using Node. Here’s a link if you’re interested: https://www.lowjs.org/.

2. Android

Without going into too much detail about React Native or Flutter, it’s even simpler to create a Node application on your mobile device.

android node mobile app

3. Desktop applications

Electron allows you to create a desktop application using Node. It’s not the greatest solution, but if you want to make some simple, memory-cheap application or move an existing web one, you should really consider trying it.

But remember not to rely on Electron when dealing with high RAM utilization. Read more about why not here.

4. CMS

Content Management Systems are dominated by PHP solutions.

Over 61% of sites with CMS use WordPress and less than 0.1% use Node’s most popular headless CMS – Ghost. While it will take years to overtake that market, I believe this perspective of writing the same language in frontend and backend will win over many full-stack developers. I hope to see Ghost integration and webhooks in further development, so writing custom plugins will be as easy as in WP or even easier. Remember how powerful a tool NPM is and imagine similar plugin library for your CMS. Wouldn’t it be great?

5. Web Development, React SSR, Pug

All these previous examples don’t involve the most obvious usage of Node – creating web applications running Javascript both on frontend and backend. We have real-life examples of Node.js backend serving million of clients and high numbers of RPS and recommend this article if you’re interested in this topic. Node servers may not be as fast as Go or Rust ones, but they allow you to create highly scalable microservices architecture. It also has an ability to create advanced, server-side rendered HTML templates using Pug or even React with SSR (for example using Next.js).

6. Node OS (Fuchsia)

For me, this is the most interesting example and maybe the future of Node. A couple of years ago, Google announced they were working on a new open-source operating system. It’s called Fuchsia and it can bring even more interest in writing cross-platform applications using Javascript. It would potentially be able to run applications like Visual Studio Code (remember Electron, right?) on your mobile as well as on your desktop. If you feel strong in Node.js core development and have knowledge about C++ and C++ toolchain, Google may have a job for you.

Conclusion – Node is one language to rule them all?

So is Node.js our ultimate “one ring to rule them all”? Of course not, it’s just a catchy title. There is no #1 programming language and probably never will be.

But it is a very interesting multipurpose tool which allows you to quickly create prototypes of all sorts of applications. It’s perfect when creating MVP and I, for one, am really looking forward to its bright and glorious future.

Send this to a friend