Getting Started with Deno
Written by Preston Lamb
Posted on Feb 8, 2021
What is Deno?
Benefits of Deno
- It has been built with security by default. There is no access to the file system, network, or environment information by default. All that access needs to be given explicitly when the application is run. If you haven’t given your application access to the network, you don’t have to worry about it using the network. The security issues that arise in Node applications, for example, should be limited in Deno applications.
- It supports TypeScript out of the box. There’s no need to use any extra tools to compile your TypeScript. Just create a file with a
- It comes with several utilities and tools that are provided for your use. Some of those tools are a bundler, a formatter, a linter, and a documentation generator. These are all part of the command line interface that’s provided after installing Deno on your machine. There's no need to waste time choosing these tools on your own because they come provided for you.
- There is a standard library, which contains packages that can be used for many common tasks. Some examples are
datetime, which eliminates the need for
date-fns, or similar libraries; and
colorswhich eliminate the need for
These are just some of the benefits of using Deno. They'll be covered in more depth throughout the book.
Differences Between Deno and Node.js
Before selecting Deno, it may help to look at some of the differences between Deno and Node. Here are some of those differences:
- It uses “ES Modules”, and thus does not support “require()” when bringing in external modules to a file.
- Deno requires explicit permission for network access, file access, and environment access. This prevents unwanted access being granted to malicious third party packages.
- It always dies on uncaught errors. The consistency of behavior is beneficial when writing applications.
This is just a starting point of the benefits of Deno and its differences with Node. As you go through this book, you'll learn more about those benefits and differences. By the end of the book you should be able to make an informed decision on your choice of technology. You should also be on your way to effectively working with Deno while writing your scripts and applications.