The DENO-saur is in the room

🦖 Is DENO the next Node.js?

Author

Luca Fedrizzi

19 Aug 2020

When it comes to server-side Javascript the undisputed king is Node.js. Recently, however, I came across Deno, a runtime for JavaScript that looks promising. This article will tell you why I think it could become the successor to the good old Node.js.

Using the same language for the frontend and the backend Node.js has significantly lowered its adoption cost and it has grown at an insane speed.

Every day new packages come out (such as our react-yearly-calendar) which add up to a large amount of the existing ones, so much so that npm seems to be exploding.

Although Node.js has many qualities and offers many advantages, among which the vast community, it doesn’t come without flaws. There are still several features that we find in Webpack, such as the ECMAScript modules which are still in the experimental phase.

Ryan Dahl, the creator of Node.js, responded to the need for modernization. In 2018 he announced Deno with a talk entitled “10 Things I Regret About Node.js”. It says a lot about how much work should be done to improve Node.

Let’s see some of the improvements that make Deno noteworthy.

Typescript

The JS community is slowly moving towards a massive use of Typescript, the superset that adds types to JS. The most important feature that Deno has in its arsenal is that Typescript works without having to install any additional packages. By running:

deno run hello-world.ts

Everything will magically work on its own. No need to install typescript or a dedicated bundler. Nothing. Awesome!

A single file

Anyone who has installed Node.js at least once knows that its installation is not as clean as one might think. It creates many configuration files and folders in hidden places.

Deno, on the other hand, is distributed as a single executable with no dependencies. This makes having and maintaining different versions at the same time way more convenient.

No more node_modules

Furthermore the mechanism for linking to external libraries is fundamentally centralized through the NPM repository, which is not inline with the ideals of the web.” — Ryan Dahl, Bert Belder, and Bartek Iwańczuk

With Deno it is possible do this:

deno run https://deno.land/std/examples/welcome.ts

With this command, we are executing a Typescript file directly from the specified url. This opens the possibility to execute Javascript or Typescript files from any CDN like skypack.dev or jspm.io.

Also, note the URL https://deno.land/std. Deno’s “standard modules” are distributed using URLs and edited directly by them. In short: no more yarn install.

Unfortunately, many of the npm libraries we are used to are not compatible with Deno, but they will be since they are working on a package compatibility layer on npm.

Safe

Unless specified in the start command, scripts executed with Deno will not have access to sensitive parts of the system, such as files or the network. For example, in order to gain access to the network you will need to use the --allow-net parameter.

And much more

These are just some of the new features that Deno brings to us, we have only touched the surface. I highly recommend taking a look at https://deno.land/manual for more information.

Deno’s future

Deno’s technology is so new that any strong opinion on its future is just speculation. Although the version 1.0 was released only a few days ago I can already make some initial considerations based on what I tried.

Although some features of Deno make it much more modern than Node.js, the latter has now reached a level of maturity that makes it hard to replace it in production.I do not recommend you to do it, at least for the time being.

Furthermore, Deno is built in Rust, a relatively recent language and with a user base not as vast as C ++ (used to create Node.js).

On the other hand, they both use Chrome’s V8, so as for what goes on under the hood, we have nothing to worry about. The performances are directly comparable since the part that will vary will be exclusively the one where the two teams will get their hands.

Deno and me in the next few months

I consider Deno the most relevant web technology to follow in this second half of 2020. With its 66k stars on GitHub it is very promising and could shake the JavaScript world!

I will undoubtedly use it as a development environment for my next Typescript projects, possibly adding it soon to my current work toolbox. The speed it offers to start something new is unbeatable and I cannot give up on Typescript anymore.

Author

Luca Fedrizzi

Keep in touch with us!

We like to share what we learn. You can get our discoveries in your inbox subscribing to our newsletter.

Subscribing you accept to receive our newsletter. We will use your email address to send you our articles.
Read the privacy policy here.