Nodejs (most likely) successor has arrived and it’s called Deno. Created by Ryan Dahl (also known for the creation of Nodejs), this hot new runtime for JavaScript (JS) has got everyone talking. Let’s explore it in detail.

*Fun Fact* Deno is actually an anagram of Node. Cool right!?

What Is Deno?

Going through the official manual I found this:

“Deno is a JavaScript/TypeScript runtime with secure defaults and great developer experience. It’s built on V8, Rust, and Tokio.”

As mentioned above, it is created by the exact same person who started Node.js way back in ’09 and is designed to be a replacement for our beloved Nodejs. The design stems from ten things he thought were wrong with Nodejs.

So, does Deno have what it takes to replace Nodejs? Well, since it is created by the same person who started Nodejs (already mentioned many times above), and as it directly addresses shortcomings in Nodejs, so that does put it off to a good start. Now, let’s take a look at some of the underlying technologies and see if that matters.

What Powers Deno

So in the manual, it mentions the following three:

  • V8
  • Rust
  • Tokio

Not really helpful if you don’t know what those are.

Written in C++, V8 is Google’s high-performance JavaScript (and now WebAssembly) engine, in other words, it is a C++ program, which receives JavaScript code, compiles it into machine code at the execution by implementing a JIT (Just-In-Time) compiler for ultra-fast performance. This engine was designed to increase the performance of JavaScript execution inside web browsers, Node.js and Chrome use it now. Here are some other great things about V8.

A systems programming language, Rust is largely viewed as an alternative to other systems programming languages, like C or C++. Blazing fast, it does not use any runtime or garbage collector and is primarily focused on performance & memory safety (especially safe concurrency). Here is some more great information about Rust.

Fast, reliable, and scalable, Tokio is an event-driven, non-blocking I/O platform for writing reliable, asynchronous, and lightweight applications with the Rust.

I’m pretty sure that most of the readers (if not all) will sense a pattern here. Deno is comprised of technologies that are fast, lightweight, and safe. We’re off to a great start.

So Why Something New?

As mentioned above, Nodejs was started by Ryan back in ’09, JS has changed a bit (if not a lot) since then, whether its development-wise, performance-wise, or features-wise, and during all this time Nodejs has done its best to keep up. Perhaps the best way forward is to start over fresh.

According to Ryan, the following are some of the issues with the design of Node.js:

  • The module system and its distribution
  • Legacy APIs that must be supported
  • Security issues

Deno is here to fix all of these issues.

Deno modules can be hosted anywhere

I don’t know if you know this or not, but browsers loads modules by URLs, Deno works similarly too and it makes sense. By using URLs, Deno modules can be hosted almost anywhere, without a centralized registry such as npm, which comes with a number of issues (I just don’t want to discuss them here). So, no more package.json and node_modules.

When the application is started, Deno downloads all the imported packages and caches them locally. Once that’s done, Deno will not download them again until you specifically ask for it.

So, now that you know all this, I hope you wouldn’t get confused and surprised when you first see an import statement with a URL on the server-side.

Security in Deno is integrated

Deno is based around “Security” as its first principle. 

Unlike Node, Deno by default executes the code in a sandbox, meaning that runtime has no access to file or network resources unless explicitly enabled. It dies on uncaught errors.

TypeScript (TS) support out of the box

This is purely for developers. You don’t have to manually configure your environment to work in TypeScript, Deno supports it out of the box, so take full advantage of it for development and use all those fancy explicit types and other goodness from the language. 

The Biggest Upside?

As mentioned above, Deno is based around “Security” as its first principle, and not only it promises safety but also performance. Now that’s all good but its biggest advantage is that it makes the life of a developer easier. Not only does it allow you to use ES6, TypeScript, and remote repositories but it also allows you to:

  • Test with Deno – We all developers know how frustrating and tiring it is looking for the best tool to test our product. Well, not anymore as there is a test runner built into the core.
  • Format your Code – Deno ships with a built-in code formatter that auto-formats TS and JS code. In other words, there is no need for external dependencies such as Prettier. If you want you can also ignore formatting code.
  • Compile and Bundle – Generally performed by module bundlers such as webpack and parcel, bundling is the process of taking your app and dependencies, and outputting it into a single JS file that can be executed. Although, this is immature at the moment, but still it has a pretty decent bundler, and you can expect more improvements in the future.

So, this was the list of all the improvements focused on developers. While people will be (most likely) praising its speed and security, it’s good to know that it won’t be that difficult for developers to create applications with Deno.

Oh, and it has a single executable to run. Having a single executable allows you to bundle Deno with apps easily and keeps the size footprint low. Also, you update it when you want, and don’t have to fear what’s going on with the dependencies at the time.

Final thoughts…

Ok, so we discussed a lot of things about Deno, its safe, its fast, and it’s great for developers. Now, all these things do make it pretty cool, but it’s still in a very early phase, it just hit v1 recently. Deno is working on a lot of things, for instance, as mentioned above the bundler is still not 100%. So, it will take them some time to become stable.

Also, as mentioned before, we don’t use NPM with Deno, now it’s quite beneficial but there is actually a little bit of a downside too at the moment. JS is based around the NPM packages and the downside is that many of these packages are not going to be compatible with Deno right away.

Surely as time passes, people will start writing packages compatible with Deno, so I guess you will have to wait till then. With all that said, the future is bright for Deno, and I can’t wait to dig in and build things with it.

Leave a Comment

The reCAPTCHA verification period has expired. Please reload the page.