What is Deno?
Learn about Deno and the technologies behind it.
We'll cover the following
Deno is a single binary and multi-platform (Linux, macOS, Windows) executable without external dependencies. It was created by Ryan Dahl, who is also the creator of Node.js. Deno published its major stable release (v1.0) in May 2020, and new versions are regularly delivered.
Why another runtime?
Deno can be seen as an upgrade to Node.js that addresses any of Dahl’s “regrets” in the previous system. To put it simply, Deno can do precisely the same things as Node.js in a faster and safer way. Node became too successful and grew exponentially to include disruptive improvements. These improvements would have created breaking changes for existing production applications. Starting from a clean base allowed Dahl to add many innovative technologies and best architectural practices.
Deno foundations
Deno is built on the V8 JavaScript engine, Rust and Tokio.
V8 is Google’s open-source high-performance JavaScript and WebAssembly engine, written in C++. It is used in Node.js as well as in Chrome.
It compiles and executes JavaScript to optimize machine code before its execution. While initially designed to be executed only by browsers, the latest releases also allow server-side scripting.
Deno was originally written in Go, but this was soon replaced by Rust due to performance and the lack of garbage collection. Rust allows us to store data on the stack, or the heap, and evaluate at compile time when this data is no longer needed. This approach ensures an efficient way to access the memory, removing the need for a garbage collector, which runs continuously. With direct access to hardware, Rust became the ideal language for low-level (often called bare metal) development, replacing C++ in many cases. Besides these technical aspects, the Rust community is also highly active and supportive. Therefore, it is easy to find a multitude of resources to learn this language in detail.
Besides these technical aspects, the Rust community is also highly active and supportive. Therefore it is straightforward to find a multitude of resources to learn this language in detail.
Tokio is an asynchronous runtime for the Rust programming language. It is to Deno what libuv was to Node. It provides exceptional applications performance with minimal overhead thanks to a multi-threaded, work-stealing scheduler. Tokio also has a set of memory-safe APIs helping to prevent memory-related errors. These features offer a solid and reliable base for Deno.
Modern features available
Deno is written in Typescript and Rust. Both are widely used languages that can offer many advantages to create fast and performant applications.
This choice confirms the decision to adopt modern and reliable technologies at the same time.
The list below provides a glance at some of Deno’s features:
- Direct Typescript support (vanilla Javascript is still possible, though)
- Usage of ES modules
- Extensive library available, covering pretty much every requirement
- No standard package manager. Libraries can be downloaded through direct URLs
- Provides built-in tools (bundling, debugging, testing)
- Secure by default thanks to an explicit permissions system
These are just some of the features available with Deno, but it offers much more.