Try Deno as an alternative to Node.js |

Try Deno as an alternative to Node.js

Deno is a secure runtime for JavaScript and TypeScript.

Tips and gears turning
Image by :


Subscribe now

Get the highlights in your inbox every week.

Deno is a simple, modern, and secure runtime for JavaScript and TypeScript. It uses the JavaScript and WebAssembly engine V8 and is built in Rust. The project, open source under an MIT License, was created by Ryan Dahl, the developer who created Node.js.

Deno's GitHub repository outlines its goals:

  • Only ship a single executable (deno)
  • Provide secure defaults
    • Unless specifically allowed, scripts can't access files, the environment, or the network.
  • Browser compatible: The subset of Deno programs which are written completely in JavaScript and do not use the global Deno namespace (or feature test for it), ought to also be able to be run in a modern web browser without change.
  • Provide built-in tooling like unit testing, code formatting, and linting to improve developer experience.
  • Does not leak V8 concepts into user land.
  • Be able to serve HTTP efficiently

The repo also describes how Deno is different from NodeJS:

  • Deno does not use npm.
    • It uses modules referenced as URLs or file paths.
  • Deno does not use package.json in its module resolution algorithm.
  • All async actions in Deno return a promise. Thus Deno provides different APIs than Node.
  • Deno requires explicit permissions for file, network, and environment access.
  • Deno always dies on uncaught errors.
  • Uses "ES Modules" and does not support require(). Third party modules are imported via URLs:
    import * as log from "$STD_VERSION/log/mod.ts";

Install Deno


Deno GitHub repo

(Bryant Son, CC BY-SA 4.0)

Deno's website has installation instructions for various operating systems, and its complete source code is available in its GitHub repo. I run macOS, so I can install Deno with HomeBrew:

$ brew install deno

On Linux, you can download, read, and then run the install script from Deno's server:

$ curl -fsSL
$ sh ./

Run Deno

After installing Deno, the easiest way to run it is:

$ deno run

If you explore the welcome example, you should see a single line that prints "Welcome to Deno" with a dinosaur icon. Here is slightly a more complicated version that also can be found on the website:

import { serve } from "";
const s = serve({ port: 8000 });
for await (const req of s) {
  req.respond({ body: "Hello World\n" });

Save the file with a .tx extension. Run it with:

$ deno run --allow-net <name-of-your-first-deno-file.ts>

The --allow-net flag might not be necessary, but you can use it if you see an error like error: Uncaught PermissionDenied: network access to "

Now, open a browser and visit localhost:8080. It should print "Hello, World!"

That's it! You can learn more about Deno in this video I recorded.

What do you think about Deno? Please share your feedback in the comments.

Computer screen with files or windows open

A breakdown of many JavaScript options for frameworks—their strengths and key features.
JavaScript in Vim

JavaScript is a super-popular language, as evidenced by the 10 best JavaScript articles from 2020.


About the author

Bryant Son - Bryant Jimin Son is an Octocat, which not official title but likes to be called that way, at GitHub, a company widely known for hosting most open source projects in the world. At work, he is exploring different git technology, GitHub Actions, GitHub security, etc. Previously, he was a Senior Consultant at Red Hat, a technology company known for its Linux server and opensource contributions. Bryant also worked at Citi Group's Citi Cloud team, building the private Infrastructure as a Service (...