DEV Community

Shreyansh sheth
Shreyansh sheth

Posted on

Node.js & Deno Comparison

So what is Deno?

Deno is JavaScript , typescript runtime like node.js but it can run typescript natively and has so many new features related to security and module delivery.

Why compare to node.js?

At it’s core Deno is same as node and they both uses V8 engine for javascript execution and also their creator Ryan Dhal is same but they are completely different how you manage your dependencies and also files.

Why You Should Use.

Why you should use Deno?

Deno has future because of it’s growing community and also it has so many features that node is lacking and also it is so much secure and better run time than node.

Why you should use node?

Although Deno is future proof but node has so much bigger community than any other platform and also if you find yourself stuck you can easily find solution.

Things that are changed with Deno.

  • Have to give permission for accessing files read and write , net , hrtime , etc.
  • Importing modules is completely change and now you can import from url and file sitting on CDN
  • No-Package Manager / No-Modules Folder. All the modules fetch from URL cache under Deno and you don’t need to worry about that
  • Don’t worry about different setup for typescript it’s just works out of the box.
  • Deno has different built in APIs than node because all of async calls end up in some sort of promise.

Conclusion

Deno is the future, but node is current the king for JavaScript development thanks to massive size of community and millions of open source package.

Discussion (6)

Collapse
jazzbrown1 profile image
Jazz Brown

Hey nice article. Thanks for sharing. I don't think deno is the future though. Even Ryan Dahl said it's not supposed to replace node. Personally I have issues with some of the design decisions made for deno. For instance typescript as a first class citizen, which isn't really first class as it's transpiled before it runs. It just feels bloated. And while Dahl seems to hate npm I rather like it, and I don't think importing from repos makes life any easier. I do really like the deny by default security but I don't think that's enough to knock node off its throne. Deno is interesting and probably a bit better than node but it is simply not different or revolutionary enough to replace it.

Collapse
code913 profile image
code913

npm i deno

echo 'const { security } = require("deno");' >> index.js

node index.js

Collapse
amantini1997 profile image
Alessandro Amantini

I may be mistaken, but another cool feature of deno is that it supports async/await function at top level, which is my opinion is very handy.

Collapse
drmaquino profile image
Mariano Aquino

You can also do that with node latest version, if you are using es6 modules :)

Collapse
shreyanshsheth profile image
Shreyansh sheth Author

Yes, I've Forgot To Mention That . But You Can Do Same Thing With Node If You Are Using Typescript. But Deno Made It Easier Because It Supports Typescript Out Of The Box.

Collapse
tamusjroyce profile image
tamusjroyce

Deno’s speed and native compiling has won me. swc makes typescript compilation instant. lint and formatting instant. And the fact that a single small executable can generate native binaries makes it by-far better then node.js and a true competitor to .net/C#. Rust, which can be linked to, and deno was written in, is fast and secure.

I agree it won’t replace node. To do that, it would have to support nodes ecosystem. There are just to many dependencies for the simplest of things. npm really has one of the worst bloat I have ever worked with. Stepping through code there can be 30-100 frames between your code and some crazy library, including node built-in. So frustrating.