Deno
- Pronunciation
- DEE-noh
In short
Deno is an open-source JavaScript and TypeScript runtime that keeps system access locked until you grant it and ships its own formatter, linter and test runner.
What is Deno?
Deno is a runtime, the program that executes JavaScript and TypeScript on a server or a developer's machine, just as Node.js does. It was started by Ryan Dahl, the original creator of Node.js, after a 2018 talk about the design decisions he regretted in Node. It runs on Google's V8 engine like Node.js, but the rest is written in Rust; version 1.0 came out in 2020 and Deno 2 in 2024.
Three ideas set Deno apart. It runs TypeScript files directly, with no separate build step. It is secure by default: a script can't read files, open network connections or see environment variables until you grant that with flags such as --allow-net or --allow-read, much as a phone app asks for permissions. And one executable includes the everyday tools: a formatter (deno fmt), a linter (deno lint), a test runner (deno test) and a compiler that turns a script into a standalone program (deno compile).
Deno favors web-standard APIs such as fetch, Request, Response and Web Streams, so much of the same code also runs in browsers. Packages can come from npm through npm: imports or a package.json file, from JSR, a registry for JavaScript and TypeScript modules started by the Deno team, or straight from a URL. It is used for web servers and APIs, scripts and command-line tools, and serverless edge functions, including Supabase's Edge Functions and Deno's own hosting service, Deno Deploy.
The most common question is how Deno differs from Node.js. Both run largely the same JavaScript on V8, and since Deno 2 most npm packages and Node.js built-in modules such as node:fs work in Deno too, so the differences are in the defaults. Node.js gives every script full access to the system and leaves formatting and linting to separate tools, while Deno asks for permissions and includes them. The gap has narrowed: recent Node.js versions can run many TypeScript files by stripping the types and offer an opt-in permission model, while Node.js keeps the larger ecosystem and the widest hosting support.
Key takeaways
- Deno is a JavaScript and TypeScript runtime built on V8 and Rust by the original creator of Node.js.
- Scripts get no file, network or environment access until permissions are granted.
- TypeScript runs directly, and a formatter, linter, test runner and compiler are built in.
- Since Deno 2, most npm packages and Node.js built-in modules work.
- It differs from Node.js mainly in its defaults, not in the JavaScript it runs.
Example
// server.ts: TypeScript runs directly, with no build step
Deno.serve({ port: 8000 }, (req: Request) => {
const { pathname } = new URL(req.url);
return Response.json({ path: pathname, runtime: "Deno" });
});
// Network access must be granted explicitly:
// deno run --allow-net server.ts
// Without the flag, Deno asks at the prompt, or refuses in CI.
// Built-in tools, no extra packages:
// deno fmt deno lint deno test deno compile --allow-net server.tsReaders ask
What is the difference between Deno and Node.js?
Both run JavaScript on the V8 engine, and Deno can run most npm packages. Deno runs TypeScript directly, blocks file and network access until you grant permissions, and includes a formatter, linter and test runner, while Node.js has the larger ecosystem and gives scripts full access by default.
Can Deno use npm packages?
Yes. Since Deno 2 you can import them with an npm: prefix, such as npm:express, or list them in a package.json file as with Node.js. A small number of packages that depend on rarely used Node.js internals may not work.
Is Deno faster than Node.js?
For most web workloads they perform in the same range, since both are built on V8, and benchmarks vary by task. It usually makes more sense to choose on tooling, security defaults and the libraries you need than on raw speed.
See also
- Node.jsBackend & APIs, p. 35Node.js is an open-source JavaScript runtime that runs JavaScript outside the browser, most often to build web servers, APIs, and command-line tools.
- BunBackend & APIs, p. 9Bun is a fast JavaScript and TypeScript runtime that is also a package manager, bundler and test runner, designed as a drop-in replacement for Node.js.
- TypeScriptWeb Development, p. 60TypeScript is a programming language built on JavaScript that adds static types, catching many bugs before the code runs, and compiles to plain JavaScript.
- JavaScriptWeb Development, p. 29JavaScript is the programming language that runs in web browsers to make pages interactive, and it also runs on servers through runtimes like Node.js.
- npmWeb Development, p. 38npm is Node.js's default package manager and the world's largest software registry; it downloads a project's dependencies and tracks their versions.
- Principle of Least PrivilegeSecurity, p. 34The principle of least privilege is a security rule that every user, program, and service gets only the minimum access it needs to do its job, and no more.
Sources
Spotted a mistake or something missing on this page?Suggest an edit