Skip to content

Deno, a breath of fresh air for the server-side JavaScript

There’s a great reason why JavaScript is the most used programming language in the world — easy-to-learn, powerful front-end and back-end technology. I have used JavaScript for years on the browser, but since I moved to the server-side, Node.js is the technology I use most often. Even though I use other programming languages (recently mainly Go), JavaScript is the one that keeps me the most excited.

Deno artwork

Speaking of exciting things, I recently tried something new — Deno, made by the original creator of Node.js, Ryan Dahl. It’s his successor project that aims to fix all regrettable things from the Node.js design. Let me share with you why I like it so much!

Just like on the Web

If you’re coming from the browser land, Deno will feel familiar to you. ECMAScript modules are fully supported, and it works as it does on the front-end. Most of the methods from the browser are also available in Deno. No need for npm install node-fetch because fetch is already there.

import { format } from "";

console.log(format(new Date(2021, 8, 16), "yyyy-MM-dd"));
// 2021-09-16

Secure by default

One of the most significant Node.js flaws is its lack of access control. As long as you can execute a script, you can also read and write to the file system, perform network calls, access environment variables and whatnot.

Following the good, old least privileged model, Deno is secure by default and gives you granular control over permissions. However, to grant script access to particular features, we need to pass additional flags, like --allow-env, --allow-read or --allow-write, to name a few.

deno run index.js

Look ma, no package.json file

The package.json file was originally designed to store a mapping of dependencies that we can require() in the program. Over the years, it became a lot more than that. We use it to store external libraries configuration, licence information, repository links, references to types, and it’s not rare to see hundreds of custom scripts there. Deno doesn’t need it — thanks Ryan!

TypeScript support baked-in

Even though Ryan Dahl is slightly concerned about adding support to TypeScript out of the box, it’s not going to be revoked. It feels like magic to write TS code, execute it without the compilation burden, and keep the performance intact.

deno run index.ts

I believe that TypeScript is the future of JavaScript, and we will see this superset in the browser at some point. This is my little dream for the future of JS.

Linter, formatter, documentation generator…

I can’t count how many times I attended a meeting that ended up being an argument about some ESLint rules. This kind of bikeshedding will never happen in Rust or Go community because things like linters and formatters are part of the language. Deno borrowed this excellent idea, so it comes with built-in linter, formater , dependency inspector and other cool tools.

Try Deno!

There are many other reasons why I am so hyped about Deno, but hopefully, the list above is enough to make you try it out. Keep on coding curious geeks 🦖

Leave a comment

👆 you can use Markdown here

Your comment is awaiting moderation. Thanks!