Ryan Dahl, creator of Node.js, spent a year and a half working on deno, a new JavaScript runtime that solves all of Node’s inherent problems.

Don’t get me wrong, Nodejs is a great server-side JavaScript runtime on its own, mainly because it has a large ecosystem and JavaScript. However, Node.js founder Ryan Dahl admits he should have considered more – security, modules, and dependencies, to name a few.

In his defense, it’s not that he can imagine how much the platform will grow in such a short time. Also, back in 2009, JavaScript was still this weird little language that everyone made fun of, and many of its features weren’t there yet.

So what is Deno and what are its key features?

  1. Deno is a secure TypeScript Google runtime engine built on V8.

It establishes:

  1. Rust (the core of Deno is written in Rust and node is written in C++)
  2. Tokio (event loop written in Rust)
  3. TypeScript (Deno supports JavaScript and TypeScript out of the box)
  4. V8 (JavaScript runtime used by Google in Chrome and Node)

2. It supports Type2.8 out of the box, no package.json, no NPM not compatible with Node, introduces dependencies through URLS rather than through native modules, loads and caches at first run, and updates dependencies only when the code is in use.

  1. Can control the file system and network access to run sandbox code, default access read-only file system access, no network access. Access between V8 and Golang can only be done through serialized messages defined in protobuf;
  2. Eventually create a single executable;
  3. Support top-level await;
  4. The ultimate goal is browser compatibility;
  5. Can be introduced as a library to build your own JavaScript runtime.

Many of these features address current NodeJs pain points, including the absence of package.json, the introduction and updating of dependencies, and the widely derided over-size.

At the same time, it no longer pursues compatible Node, which can be seen as RY’s intention to completely abandon the burden of Node and create a better JS runtime.

One of its most important features is that it is very secure. In contrast to NodeJs, Deno executes sandboxed code by default, which means that runs are not accessible.

Let’s see how it works:

(async () => {

const encoder = new TextEncoder();

const data = encoder.encode(‘Hello world’);

await Deno.writeFile(‘HelloWorld.txt’, data);

await Deno.writeFile(‘ HelloWorld2.txt’, data);

}) ();

The script creates two text files that contain a message. The code is executing in a sandbox, so it cannot access the file system. HelloWorld.txt HelloWorld2.txt Hello world

Also note that we are using the Deno namespace instead of the FS module, as in Node. The Deno namespace provides a number of basic helper functions. By using namespaces, we are losing browser compatibility.

Of course, when we use Deno, we think about browser compatibility, and Deno is designed to be browser compatible. Technically, when using the ES module, we don’t have to use any build tools (such as Webpack) to make our application usable in the browser.

But tools like Babel convert the code to ES5 versions of JavaScript, so it can run even in older browsers that don’t support the latest features used in the language. But it also comes at the cost of having a lot of unnecessary code in the final file and bloating the output file.

It’s up to us to decide what our main goals are and make choices accordingly.

TypeScript supports out-of-the-box support

Deno makes iT easy to use TypeScript without any configuration files. You can still write programs in pure JavaScript and execute them using Deno without any trouble.

Deno, a new runtime for TypeScript and JavaScript, is an interesting project that has been growing steadily for a long time. But there is still a long way to go before it is considered ready for production.

With its decentralized approach, it needs to free up the JavaScript ecosystem from the centralized package registry, or NPM.