5-minute read

As its web site says, Deno is a simple, modern, and secure TypeScript and JavaScript runtime that uses Chrome’s V8 JavaScript engine. It’s built using the Rust programming language, in contrast with Node.js, which is built using C and C++. It’s from the creator of Node, Ryan Dahl. Notice that Deno is an anagram of the word “node” … perhaps hinting at rearranging or fixing parts of Node? Both platforms are open source.

Why should I learn Deno?

As a developer, you should aim to deliver high quality maintainable code that lasts the test of time. You should build code with your future self and others in mind. Deno shines here.

TypeScript is a first-class citizen, and most new JavaScript applications are written in TypeScript. This includes React, Angular, Node.js, and Express.js applications, and the list goes on and on. Also, most classic libraries are either ported to TypeScript or @types provided by third parties, the reason being that developers and customers want to take full advantage of the rich tooling TypeScript brings to a project.

Variables and Functions are strongly typed, which catches many coding errors long before they see the light of production. Variables aren’t left undefined or changed sporadically throughout the application lifecycle. This makes for much more reliable, predictable applications.

Other reasons include vastly improved security over Node as well many features out of the box that you can add in a traditional JavaScript application.

How is Deno different?

As I have indicated, TypeScript is the language of choice and is supported on day zero. Other differences include

• No package.json file

• No tsconfig.json file

• Dependency management

• The runtime is secure by default

Tsconfig.json is traditionally used to configure the typescript compiler (tsc). You can include a configuration file, but I find it is not generally needed. Deno enables the strict options by default—“NoImplicitAny,” “StrictNullChecking,” to name a couple.

There are also no “node_modules” directory and no package manager. Dependencies (other libraries required for the application) are imported directly into local modules. The fully qualified URL/version and file extension are required.

This can quickly become cumbersome as the application grows. A standard practice in Deno is to create a deps.ts file. The idea is to import everything in one place and re-export. Then local modules only need to reference the deps.ts file and the functions they need.

Versioning is maintained in user created lock.json file. The filename and version info are hashed in this file.

Fetch web api is also included in the Deno runtime. Node requires third-party modules for http callouts.

How do I install Deno?

Deno works on macOS, Linux, and Windows. It’s a single binary executable with no external dependencies.

Using Shell (macOS and Linux): curl -fsSL https://deno.land/x/install/install.sh | s

Using Powershell (Windows): iwr https://deno.land/x/install/install.ps1 -useb | iex

To test your installation, run deno --version. If this prints the Deno version to the console, the installation was successful.

Which tools do I need?

One of the beautiful things about Deno is the range of tools included out of the box. Bundling, linting, formatting, and testing tools are all built it. Normally you would need third-party libraries such as WebPack, ES Lint, Prettier, Jest, etc. Any Integrated Development Environment will likely do.

I use Visual Studio Code and the official Deno extension. If you search the VSCode extension gallery for Deno, you’ll quickly find it. I have included a link below, under “Links and resources.” One small “gotcha” is that you need to go into the workspace settings file and enable the plug-in.

What are some advantages to using Deno?

• Many tools are included out of the box, which can reduce time to delivery. Developers aren’t left configuring their environment for countless hours or days.

• It adds on existing developer experience, and it’s familiar to front end and backend. Developers can leverage TypeScript and JavaScript knowledge.

• Teams using a unified developer platform. Both front-end and backend code can be developed by the same teams, with no silo development. Everyone is coding in the same language. Obviously this also promotes code reuse.

• Rapid API/prototyping delivery. Proof-of-concepts can quickly be created and demo’ed to stakeholders. Very fast time development cycles.

Final thoughts

I was really impressed with Deno. I think it has a great future and is definitely worth learning. I don’t see it killing Node any time soon, as there are just so many applications out there using and relying on it.

I do feel it was a major win to have TypeScript supported and to use Rust to build it. I think startups and smaller companies will be the earlier adopters and that in time, larger enterprises will come on board. This was also true at one time about Node. No big industry took it seriously, and now it’s basically everywhere. I see Deno eventually in that same space. These are of course just my opinions.

Bottom line, give Deno a try. I think you’ll really like it.

Like what you see?

Paul Lee

Chris Kettenbach is a senior developer at Logic20/20.