Deno (software)

Deno (software)
Deno is a runtime for JavaScript, TypeScript, and WebAssembly that is based on the V8 JavaScript engine and the Rust programming language. Deno was co-created by Ryan Dahl, who also created 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.
History
Deno was announced at JSConf EU 2018 by Ryan Dahl in his talk "10 Things I Regret About Node.js". In his talk, Dahl mentioned his regrets about the initial design decisions with Node.js, focusing on his choices of not using promises in API design, usage of the legacy build system GYP, node_modules and package.json, leaving out file extensions, magical module resolution with index.js and breaking the sandboxed environment of V8. He eventually presented the prototype of Deno, aiming to achieve system call bindings through message passing with serialization tools such as Protocol Buffers, and to provide command line flags for access control.
Deno was initially written in Go and used Protocol Buffers for serialization between privileged (Go, with system call access) and unprivileged (V8) sides. However, Go was soon replaced with Rust due to concerns of double runtime and garbage collection pressure. Tokio was introduced in place of libuv as the asynchronous event-driven platform, and FlatBuffers was adopted for faster, "zero-copy" serialization and deserialization but later in August 2019, FlatBuffers was removed after publishing benchmarks that measured a significant overhead of serialization in April 2019.
A standard library, modeled after Go's standard library, was created in November 2018 to provide extensive tools and utilities, partially solving Node.js' dependency tree explosion problem.
The official Deno 1.0 was released on May 13, 2020.
Deno Deploy, inspired by Cloudflare Workers, was released on June 23, 2021. Announced May 4, 2022 Beta 4 improves the dashboard and adds billing functionality. General availability of Deno Deploy is eyed for the third quarter of 2022.
Deno Fresh 1.0 was announced June 28, 2022. It features a new full stack web framework for Deno that sends zero JavaScript to the client. The framework has no build step which allows for an order of magnitude improvements in deployments times. Version 1.1 was released September 8, 2022.
Deno SaaSKit beta was announced April 4, 2023. It is an open-source, modern SaaS template built with Fresh and Deno.
Overview
Deno aims to be a productive and secure scripting environment for the modern programmer. Similar to Node.js, Deno emphasizes event-driven architecture, providing a set of non-blocking core I/O utilities, along with their blocking versions. Deno could be used to create web servers, perform scientific computations, etc. Deno is open source software under the MIT License.
Comparison with Node.js
Deno and Node.js are both runtimes built on Google's V8 JavaScript engine, the same engine used in Google Chrome. They both have internal event loops and provide command-line interfaces for running scripts and a wide range of system utilities.
Deno mainly deviates from Node.js in the following aspects:
Supports only ES Modules like browsers where Node.js supports both ES Modules and CommonJS. CommonJS support in Deno is possible by using a compatibility layer.
Supports URLs for loading local or remote dependencies, similar to browsers, and uses module specifiers like npm: and node: to import NPM or polyfill Node.JS modules. Node.js supports both URLs and modules.
Does not require a package manager for resource fetching, thus no need for a registry like npm.
Supports TypeScript out of the box, using a snapshotted TypeScript compiler or the swc compiler with caching mechanisms.
Aims for better compatibility with browsers with a wide range of Web APIs.
Restricts file system and network access by default in order to run sandboxed code.
Supports a single API to utilize promises, ES6 and TypeScript features whereas Node.js supports both promise and callback APIs.
Minimizes core API size, while providing a large standard library with no external dependencies.
Uses message passing channels for invoking privileged system APIs and using bindings.
Funding
On March 29, 2021, Deno Land Inc was announced, with backing in millions of dollars from Shasta Ventures, Mozilla Corporation and a few others. It was established to further the development of Deno and provide a commercial offering to users.
A year on, Deno announced a further $21 million in Series A funding led by Sequoia Capital.
Release history
The tables below were created using the official Releases page.
Deno
Deno Fresh
Deno SaasKit
Examples
A basic Hello, World! program in Deno (similar to Node.js):console.log("Hello, World!");Global Deno namespaces expose APIs that are not available in the browser.
An implementation of the Unix cat program: /**
* cat.ts
*/
for (const filename of Deno.args) {
const file = await Deno.open(filename);
await file.readable.pipeTo(Deno.stdout.writable, { preventClose: true });
}
A simple Web server: Deno.serve((req) => new Response("hello world"));
Deno automatically downloads and caches the remote standard library files when the script is run, and then compiles the code.
Similarly, we can run a standard library script (such as a file server) directly without explicitly downloading, by providing the URL as the input filename (-A turns on all permissions):$ deno run -A https://deno.land/std/http/file_server.ts
Download https://deno.land/std/http/file_server.ts
Compile https://deno.land/std/http/file_server.ts
...
HTTP server listening on http://0.0.0.0:4500/
References
External links
Official Deno manual
2018 software
Free software
JavaScript programming tools
Package management systems
Run-time systems
Free software programmed in Rust