Introduction 🦕
If you don’t know Deno , it is a javascript runtime like Nodejs but with some changes.
We are not going to talk about the technical aspect here but only the advantages and disadvantages that I have in working with Deno.
Advantages
Write and play
With Deno, you no longer need to install packages with package managers like NPM, so no more heavyweight node_modules folder on your computer (and also on your conscience).
Imports are done with Urls which can be either in deno's package manager with versioning, or directly on the git directory of your favorite library.
To illustrate that, here a sample code to start a web server with Deno and Oak Server :
import { Application } from "https://deno.land/x/oak/mod.ts";
const app = new Application();
app.use((ctx) => {
ctx.response.body = "Hello world!";
});
await app.listen("127.0.0.1:8000");
You can also run codes that are not on your computer like Nessie which lets you perform database migrations directly from the command line with Deno.
deno run --allow-net --allow-read --allow-write https://deno.land/x/nessie/cli.ts init
Typescript
Yes, Deno uses typecript by default for your code writing to avoid many errors, and since typescript is the norm in this perfect world, all libraries written in Deno uses typescript are typed.
And typescript is fully integrated into our IDEs, the code is easier to debug! 😁
WebAssembly 👀
Deno integrates browser APIs and therefore has the WASM API allowing you to use functions written in other languages directly in your code.
I was personally tired of seeing Python run after installing each dependency in my NodeJs projects, it gave an impression of instability and that’s verified by running a code on different OS ...
But it's resolved as WASM is universal and standardized!
Browser APIs
Deno has (again) a big advantage, that offering browser APIs to make the javascript development environment more homogeneous with front-end javascript development.
For example : the standardized function " fetch " is available with Deno.
Custom Formatter
Deno integrates a custom formatter to make the code in your project between each developer more homogeneous with the deno fmt
command
But not everything is perfect
I only see 2 problems using Deno :
Instability
Since Deno is still young, the libraries and the runtime may have bugs.
I have often had to spend long hours debugging my code to fix crashes.
Often due to a bad cache or a version change in a dependency or runtime.
On the other hand, the more we advance in time, the more stable Deno is and the libraries also with a strong open source community.
For example, I have more easily participated in open source projects using the deno runtime to improve them than NodeJs.
Libraries
The number of available libs is still quite low, again due to Deno's age, but this number is increasing day by day (javascript ecosystem, lol)!
Conclusion
In the end, I use Deno whenever I have to do something other than frontend, instead of using NodeJs, if the library I want to use doesn't exist, then I create it and make it public to help other people.
And I learned a lot from the open-source community by operating like this!