> For the complete documentation index, see [llms.txt](https://denolib.gitbook.io/guide/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://denolib.gitbook.io/guide/codebase-basics/infrastructure.md).

# Infrastructure

Deno is composed of mainly 3 separate parts:

## 1. TypeScript Frontend

Public interfaces, APIs and important most functionalities that do not directly require syscalls are implemented here. An automatically generated TypeScript API doc is available at <https://deno.land/typedoc> at this moment (which might be changed in the future).

TypeScript/JavaScript is considered as the "unprivileged side" which does not, by default, have access to the file system or the network (as they are run on V8, which is a sandboxed environment). These are only made possible through message passing to the Rust backend, which is "privileged".

Therefore, many Deno APIs (especially file system calls) are implement on the TypeScript end as purely creating buffers for data, sending them to the Rust backend through `libdeno` middle-end bindings, and waiting (synchronously or asynchronously) for the result to be sent back.

## 2. C++ libdeno Middle-end

`libdeno` is a thin layer between the TypeScript frontend and Rust backend, serving to interact with V8 and expose only necessary bindings. It is implemented with C/C++.

`libdeno` exposes Send and Receive message passing APIs to both TypeScript and Rust sides. It is also used to initiate V8 platforms/isolates and create/load V8 snapshot (a data blob that represents serialized heap information. See <https://v8.dev/blog/custom-startup-snapshots> for details). Worth noting, the snapshot for Deno also contains a complete TypeScript compiler. This allows much shorter compiler startup time.

## 3. Rust Backend

Currently, the backend, or the "privileged side" that has file system, network and environment access, is implemented in Rust.

For those who are not familiar with the language, Rust is a systems programming language developed by Mozilla, focusing on memory and concurrency safeties. It is also used in projects like [Servo](https://servo.org/).

The Rust backend is migrated from Go, which served to create the original Deno prototype present in June 2018. Reasons for the switch is due to concerns about double GC. Read more in [this thread](https://github.com/denoland/deno/issues/205).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://denolib.gitbook.io/guide/codebase-basics/infrastructure.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
