X
Business

Deno 1.0: Node.js makers have new JavaScript runtime for TypeScript programming language

Server-side JavaScript runtime Deno version 1.0 arrives to fix problems with Node.js.
Written by Liam Tung, Contributing Writer

The makers of the widely used JavaScript server-side runtime, Node.js, have released Deno 1.0, a new runtime for JavaScript and TypeScript that addresses "design mistakes" in Node.js.

The Deno JavaScript project has been under development by Node.js creator Ryan Dahl for the past two years and his team of contributors has now released Deno 1.0, which could become just as important for JavaScript developers as Node.js.

JavaScript is one of the most widely used programming languages, and it's employed on every device with a web browser. Just like Node.js or Node, the Deno runtime is for executing JavaScript outside a web browser. 

SEE: Six in-demand programming languages: Getting started (free PDF)

However, unlike Node.js, Deno offers first-class support for Microsoft's increasingly popular Typescript, a superset of JavaScript designed for large projects. 

Deno is based on Google's Chromium V8 JavaScript engine and written in programming language Rust as opposed to C++ for Node. 

Besides fixing problems with Node.js, Dahl also wanted Deno to cater for JavaScript being a very different language today than it was in 2009, when he designed Node. Additionally, because of Node's wide use, Node has become difficult to update. 

"With the changing JavaScript language, and new additions like TypeScript, building Node projects can become an arduous endeavor, involving managing build systems and other heavy-handed tooling that takes away from the fun of dynamic language scripting," writes Dahl in a blogpost co-authored by fellow Deno developers Bert Belder and Bartek Iwańczuk. 

"Furthermore the mechanism for linking to external libraries is fundamentally centralized through the NPM repository, which is not in line with the ideals of the web," he adds, referring to Node's NPM packages.  

The Deno core is written in Rust, and Deno 1.0's main component is the Deno command line interface (CLI). 

Dahl says Deno is not a monolithic program, but rather a collection of Rust "crates" – packages or software libraries – that allow integration at different layers. For example, the Deno core crate is the "very bare bones" of Deno, while the rusty_v8 crate provides Rust bindings to V8's C++ application programming interface (API). 

"The crate provides binaries that are built in GitHub Actions CI, but it also allows users to compile V8 from scratch and adjust its many build configurations," Dahl writes.

"All the V8 source code is distributed in the crate itself. Finally rusty_v8 attempts to be a safe interface. It's not yet 100% safe, but we're getting close. Being able to interact with a VM as complex as V8 in a safe way is quite amazing and has allowed us to discover many difficult bugs in Deno itself."

SEE: Programming language Rust's adoption problem: Developers reveal why more aren't using it

Dahl also stresses that Deno is not a fork of Node, but a completely new implementation, albeit with similar goals to Node. It's also not, in general, compatible with NPM. However Dahl expects Deno will eventually be able to run more Node programs out of the box.

Deno's performance on web server is about equal to Node, according to Dahl, but Deno has better latency than Node. 

"A hello-world Deno HTTP server does about 25k requests per second with a max latency of 1.3 milliseconds. A comparable Node program does 34k requests per second with a rather erratic max latency between 2 and 300 milliseconds," he notes.

Editorial standards