What is Deno?
Key Features of Deno
Deno Uses TypeScript
One of the most eye catching features of Deno is that it treats TypeScript as a first class language out of the box. This means you can run or use TypeScript without installing any other external or third party packages. It just works.
Deno is Secure by Default
Deno by default is secure. This means that unless the script is specifically allowed, it cannot access system files, the environment (things like environment variables), or the network.
In order to specifically allow for access to these features, you need to pass the respective flag in the CLI command. Here are some of the ones you’ll use the most:
- Network access:
--allow-net, you can also specify which URLs the code is allowed to access. For example:
- File access:
- Environment access:
Deno’s Browser Compatibility
Like I mentioned above, Deno strives to have the same API as the browser. The biggest of these in my opinion is the support of the fetch API.
fetch API. Being able to use the same syntax on my server side code makes it a lot easier to be productive and it makes the load of context switching much smaller.
Deno doesn’t have a package manager registry. Node uses
npm in order to load third party packages into your project, but Deno loads modules via URLs.
I was honestly confused at first by this. Having “grown up” with Node and npm it was weird to me to not have some sort of package manager or
Instead of this centralized registry, Deno allows package developers to host their code wherever they want. If the code is hosted on GitHub, you can register your module on their hosting service where it is cached. That makes it easier for developers to find and use the module.
Deno also uses ES Modules and does not support the
Deno ships with a standard library that contains functionality that is audited by the Deno team. This makes it really easy to get started using Deno.
There is no need to look to third party packages to do fairly basic things that are needed in server side code. As a developer, it is comforting knowing that the code I use is officially supported and approved by the Deno team.
One of the modules included in the standard library is the testing module. This module makes writing tests easier in Deno and will make them more consistent across projects. T
his might not be a plus for everyone, especially if some have strong opinions on testing libraries. I really like it though. As Deno continues to grow, consistency across projects will make maintaining code and switching projects much easier.
Deno vs Node
The biggest question surrounding Deno is how it compares to Node.
Deno clearly offers some advantages over Node. Being secure by default is definitely an attractive feature, and developers will see the out of the box support for TypeScript as a big win.
On the other hand, Node has a very rich community with an established ecosystem and third party packages that make it easier to get up and running. With the announcement that Deno will support most npm packages I can see people moving over to Deno sooner rather than later.
The experience I’ve had with Deno over the last several months has been a lot of fun. I’ve enjoyed working with it and am excited to see what the future brings for it.
Over the next few weeks I’ll be writing several posts diving deeper into the Deno world.
If you read this far, tweet to the author to show them you care.