2.2 Overall architecture

The architecture of Deno

Deno is a small monolith and runs as a single process. This is the same as other major interpreted runtimes like Node.js, Python, R, etc. All the runtimes run as a single process, with enough multi-threading to take care of CPU intensive operations.
Deno is written in Rust, Typescript, and Javascript. Yes, Deno has a major component that is written in Javascript, not Typescript. It's the Deno runtime. It used to be in Typescript, but then it got ported to pure Javascript without any ES modules.
Deno has five major components that do most of the heavy work. In addition to these five major components, there are three very important third-party libraries. These third-party libraries are critical for Deno. These libraries make it possible for Deno to run Javascript programs and also stay async in all of its internal code.

Block diagram

Following is the block diagram that shows the major components that make Deno. This diagram shows all the components that make Deno, including third-party.
There are eight major components in Deno. Five are from the Deno project, while the remaining three are third-party.
Let's take a brief look at all the major components. We'll also go over them in detail in the next few sections.

Major components


This is one of the major parts of Deno. Except for the critical third-party components like tokio and v8, a majority of the user facing Deno functionality is implemented in CLI. This also works as the glue between all the other components. CLI is like an orchestrator and an executor. CLI orchestrates executing a TS/JS program with the help of the services from itself and all the other components. CLI is where the Deno process starts from. This is what runs when a Typescript program is executed in Deno.


Runtime is the next major part of Deno. The runtime consists of the deno runtime code in Javascript, majority of the low-level ops, inspector, metrics, and some important features like main worker, web worker, permissions, etc.


Core is a component that offers it's services to both the sides: on one side, it works with rust parts of Deno such as CLI and runtime, and on the other side, core offers services that can be called directly from Deno runtime in Javascript. While CLI acts as an orchestrator, the core provides some of the critical functionality to run TS/JS code and to support interworking between JS and Rust. The core implements important functionalities like v8 bindings, flags, modules, JsRuntime, zero, shared queue, etc. The purpose of the existence of core is to provide some of the low-level functionality.


Every major runtime or programming language comes with a standard library. Deno is no different. The standard library of Deno offers additional functionality, utilities, etc. The standard library is completely written in Typescript. Unlike Node.js, Deno's standard library offers fully async functionality.


This is the last major component that is part of the Deno project but doesn't reside in Deno's primary GitHub repository. Rusty_v8 has its own repository, but it comes under the Deno umbrella. It could be treated as a third-party service.
Rusty_v8 provides high-quality rust bindings to V8's C++ API.


Tokio is a third-party component, but it is a backbone for Deno. Deno wouldn't have been fully async if tokio wasn't there. Tokio is a runtime for writing reliable, asynchronous, and slim applications with the Rust programming language. Deno relies completely on tokio to offer asynchronous functionality.


This is a third-party component, but this is the one that runs the JS code. This is a very important part of Deno and Node.js too. JS programs can't execute if there is no V8 engine.
V8 is Google’s open-source high-performance JavaScript and WebAssembly engine, written in C++. V8 is very complicated and has a very large API.

Typescript compiler

The typescript compiler is the final major third-party component in Deno (not shown in the diagram above). As mentioned earlier, V8 can only run JS code. Deno supports both TS and JS. Deno needs to convert TS to JS before giving it to V8. This is done by the TS compiler. There are two types of compilers: one provided by microsoft which can do typechecking and transpilation, and the other one is SWC which does only transpilation. Transpilation means converting TS code to JS code.
That was about the overall architecture and a brief on the major components present in Deno. Now, let's see each of the components in detail.