Deno vs Node.js — Is this the future of Node.js?

Madhuresh Gupta
Quick Code
Published in
4 min readMay 24, 2020

--

Hello everyone! I have been seeing this new hype coming up here in the JavaScript world… and it’s the new runtime for servers “Deno”.

So would like to take this opportunity to give my views on the same. So what is Deno? If you go it’s official website you will see it has been described as “Deno is a secure runtime for JavaScript and Typescript” just like what Node.js is used and is created by the same person who created Node.js, Ryan Dahl. He created Deno to fix some of the flaws what Node.js had.

Now “Deno” is was basically just an anagram for node.JS and indeed they know as we can see here on their official page download that Deno is a secure runtime for JavaScript and Typescript if we have a look at nodejs.org we see that’s not too far away from what we find their node.JS is a JavaScript runtime built on chrome’s V8 JavaScript engine and indeed there now in the end is a new JavaScript runtime developed by the inventor of node.JS

Now you’ll find a couple of points by Ryan himself which you can find on YouTube where he basically announces Deno and shares his thoughts about why he had the feeling that there was a need for Deno and why we need a replacement for node.JS but not replacement in the sense of you should replace node.JS with it, but instead you could look into Deno because it might be able to do the same thing in a better way however that’s a big huge disclaimer here- At this point Deno is in very, very early stages where presumably we are only a few days into version 1.0 being released though 1.0 will not be the final destination the end of Deno where everything is finished, instead it’s just the first a bit more final version of it you could say now.

Although the source repository is quite popular as it managed to collect quite a few GitHub stars (if you take this as a matter for popularity).

One thing worth noting and keeping in mind that node.JS is getting used by a lot of huge companies out there that there are tons of projects and websites and package is built with node.JS and that’s quite a mature and developed runtime so it’s not brand new and full of bugs instead this is production ready and getting used a lot. And let me make this very clear node.JS is not going to go anywhere but of course you don’t have to take this from me you can take it from Ryan himself:

Deno and Node under the hood:

Node.js is based on C++ uses the V8 engine to execute JavaScript code. The V8 engine itself, was originally developed for Google Chrome to execute JavaScript in the browser very quickly. Meanwhile even the new Microsoft Edge version is based on chrome V8.

Deno also relies on the V8 engine, but instead of C++, Deno is also based on Rust — a programming language that is supposed to deliver similarly good performance as C++, but also places special emphasis on security. I will be writing on this language in my upcoming blog but in short we can say using Rust language, memory access errors or buffer overflows should be avoided since Rust has no garbage values.

And security is one thing — a common criticism of Node.js is that once a node app is running, it can easily access the file system or the network for example and Deno wants to avoid this by requiring the person running the Deno app to first allow what Deno wants to do.

One big difference is that Deno supports Typescript out of the box and has the compiler in built.

Also, it ships only a single executable file unlike node.JS which ends up in multiple folders.

Deno also has built-in utilities like a dependency inspector (deno info) and a code formatter (deno fmt) which makes coding and developing using Deno much easier and hassle free experience.

Now another great thing about Deno is that it can import any modules from any location on the web like GitHub, a personal server or local website unlike node.JS for which we can only use a single place and that’s npm. This makes it easier for any organization to develop their own private modules, host it in their personal server and developers now can just enter the URL to import the module.

All in all, I can say Deno looks like a very promising runtime but we need to take this with a grain of salt that since it is still in version 1.0. Meaning there’s a long way to go when people and organization has a widespread adoption to this technology. What do you think of Deno? Would you give it a try?

Originally published at http://madhureshgupta.home.blog on May 24, 2020.

--

--

Madhuresh Gupta
Quick Code

Follows Microsoft, Tesla Motors, SpaceX, Google, Elon Musk. Aviation Admirer!