Deno is a simple, modern and secure runtime for JavaScript and TypeScript. It’s built on V8, Rust, and Tokio.
- V8 is the Google runtime engine for JavaScript.
- Rust is a modern systems programming language developed by the Mozilla Corporation. Deno’s core is written in Rust.
- Tokio is an asynchronous runtime for the Rust programming language.
Deno was developed by Ryan Dahl, the original creator of NodeJs. The primary objective behind developing Deno was to fix all the inherent problems of Node. According to Dahl, Node.js suffers from three major design issues – poor module management, lack of security and lots of legacy APIs that must be supported. It was announced by Dahl in 2018 during his talk “10 Things I Regret About Node.js” and is intended to fix design problems in Node.js. Deno explicitly takes on the role of both runtime and package manager within a single executable, rather than requiring a separate package-management program.
Deno Features:
Deno offers following features-
1. Security:
Deno is secure by default. Unlike Nodejs, Deno runtime has no access to the file system, network and the environment variables unless explicitly enabled. Permission can be given at file, folder level, or network path level with the --allow
flag, which provides better control on read/write operations. Another important feature that has been introduced in Deno is that it always dies on uncaught errors, unlike Node.js, which will allow execution to proceed after an uncaught error, which might end with unpredictable results.
2. Supports TypeScript:
Deno supports TypeScript out of the box. By default the Deno is transpiled into JavaScript. So, if you use TypeScript, no other tools are required for transpilation. Just run the Deno binary. No config, no hustle. It is also possible to write programs in plain JavaScript and execute them with Deno.
3. Module Management:
Deno has no package manager. Deno loads dependent modules by URLs or file paths just like browsers, no more package.json
and npm install
is required to install dependencies. Deno downloads all the imported modules and caches them on first execution. The modules are stored on our local disk. It will never download them again until we specifically run the code with the --reload flag
. Therefore, you should be able to run Deno programs that are already on your laptop, even if you are on an airplane with no internet connectivity.
4. Built-in Tools:
Deno has built-in tooling like unit testing, code formatting, and linting to improve developer experience.
5. Browser Compatibility:
Application scripts can be bundled into a single JavaScript file which will run on all browsers without any trouble. Deno uses ES Modules, we don’t have to use any build tools like webpack to make our application ready to use in a browser.
Deno Releases:
Initial version of Deno was released on 13 May, 2018. Latest stable version is 1.3.3, released on 4 Sep, 2020.
Summary:
Deno can be embraced as the “better” NodeJs. NodeJs is popular, it has been in the industry for last 10 years and it will definitely continue to be the de facto standard in the JavaScript world.
You may also like: Getting Started With Deno