DEV Community

Cover image for What is Deno? Will it replace Node.js?
Ashwin Khode
Ashwin Khode

Posted on

What is Deno? Will it replace Node.js?

This is my first blog ever. Hope you all like it! ✌

Deno v1 has just recently released and this is a new runtime for JavaScript. So think about Node as what you already know and Deno is upgraded newer version of Node.js. It is created by the exact same person who created Node.js. It is built using V8 engine, Rust & TypeScript 🔥

Ryan Dahl is the creator of Deno. He saw all the shortcomings and old technology used in node.js, So he decided to built a better version of Node.js. But by the time he realized that Node.js needs some upgrade, it was impossible for him to do so. Because Node.js gained so much popularity in such a small amount of time, there were so many packages and applications using Node.js everywhere. So Ryan Dahl couldn't afford to take the risk of manipulating Node.js and breaking things all over the internet. So he wanted essentially to recreate node.js in a better form and that's why they he created Deno. Deno is very similar to Node.js and do a lot of things that node does but with a lot of advantages. So here are the advantages of Deno :

1) Deno is built in TypeScript

One of the biggest advantage of Deno is it has TypeScript support. You dont have to manually configure your environment to work in TypeScript, you can use it right out of the box with Deno have compiler and everything built-in so you dont have to worry about any TypeScript configuration. It's all there for you!

2) Browser compatibility & Module imports

So in node.js if you want to for ex, fetch a resource, you have to import a library to do that,
while in the browser you just use fetch. Also you will notice a lot of the Node based API are all using callbacks instead of using Async/Await. So in Deno they have scratched all of that old code
got rid of that and said, " we are gonna make everything promise based ". So in Deno everything will be based on promises and Async/Await.

And on top of this, when you import a modules instead of doing traditional Node.js way using 'require(module)', you can simply import things using browser based 'import/export' syntax
from ES6. This allows us to do things similarly like we would do in the browser. On top of that, all of the browser based API built on Deno can be run in the browser or outside the browser using Deno & this is really POWERFUL!

On top of that browser compatibility, Deno takes it even a step further, they have included a library with a bunch of useful packages which normally browser doesn't provide us. So we have to follow a standard library without worrying about browsers. How cool is that!

3) Handling Security

Deno is based around Security as its first principle. So Deno scripts cannot access the hard drive, open network connections, or make any other potentially malicious actions without permission. Deno provides us with a command-line flag '--allow-net' to give access to all the external permissions for script.

If you import a package and somehow it is corrupted or malicious or contains bad code which can corrupt your files or delete all the files on your system, if you run script containing that package in Node.js you would definitely lose everything on your computer it would delete everything but in Deno, unless you explicitly give your program the ability to delete files from your computer, your program wont be able to do anything like that without your permission. So Deno really cares about your Security!

4) Package management

With node.js, you get npm to manage your packages. But in Deno, you can directly install packages from URL or directly use them by importing that package as an library in your script from URL.
On top of that, there is no 'package.json' file for managing dependencies and there is no 'node_modules' folder, all of that is handled in the background by Deno and stored in the computer as a central dependencies. So you dont have to worry about massive node_modules folder or package.json files to use packages. Clean Workspace!

Closing thoughts :

As excited as you all are to gets your hands on Deno, I am too!
Some of you will ask "Is it going to replace Node.js?"
Well, that's not going to be the case right now. To be honest, Deno has just released its version 1 it is still in its beta version, this means they are still working on its features to put it out in the market. I know it has so cool features but it is still in its early stage, even its browser compatibility is not 100% sure they are still implementing browser APIs and they are going to continuously implement those as time goes on, so that is going to be a continuous effort.
Another question is "Should I learn Node or wait for Deno to come?"
I recommend you should learn Node.js first because there is not much Deno based APIs. If you skip Node.js you are missing a whole world of Node.js, npm and its ecosystem. Unless you know the downside of node how would you know the advantages of Deno. So use Node.js as of now, let Deno build its ecosystem then it will be ready to take over Node.js! It's not gonna take days or months it may take 4-5 years for Deno to make its mark onto Web World. Hope you liked it! Thank you!

Follow me on :

Instagram : @ui.ashwin
Twitter : @ashwin4real
Linkedin : Ashwin Khode

Top comments (14)

Collapse
 
leob profile image
leob • Edited

So my takeaway is that Deno is very very cool, but (a) there is no point yet in using it, (b) as of now people are advised to just learn Node.js.

I say don't waste time on it, just let it "mature" till it reaches version 7 or whatever and then we'll talk again. In the meantime just use Node.js and be productive with the tools we already know and love.

So, the answer to "Will it replace Node.js?" would be "no", in my opinion.

Collapse
 
gadrawingz profile image
Gad Iradufasha • Edited

of course, But there is no point in learning language(library) just because people say its cool, As real dev's we have to master one language then We can take another lingo if we found the first one miss some important features(we need). That my thoughts!

Collapse
 
ashwinkhode profile image
Ashwin Khode

Absolutely!

Collapse
 
leob profile image
leob

By the way LOL only now I noticed that "deno" is an anagram of "node", man was I thick :-)

Thread Thread
 
diogomgbrito profile image
Diogo Brito

🤯

Collapse
 
stealthmusic profile image
Jan Wedel • Edited

Great post, as Java backend dev that also does frontend too, I really hate most about node and especially npm, so I’m really looking forward to a Typescript variant Of node with better module system.

One general hint for articles: Add some links to things you mention. Eg the Deno Project Page and other references that might help the reader.

Collapse
 
raphaelchaula profile image
Raphael Chaula

I believe Deno will replace Node in years to come.

Collapse
 
spez profile image
Abhigyan

Ryan Dahl explains the dark-side of NodeJS in this video

Collapse
 
fly profile image
joon

Brilliant first post!
Had no idea that an alternative for Node was being developed :)
Thank you Ashwin

Collapse
 
ashwinkhode profile image
Ashwin Khode

Glad you liked it!

Collapse
 
crisarji profile image
crisarji

console.log("node".split("").sort().join(""))

Collapse
 
darryl profile image
Darryl Young

Thanks for sharing, Ashwin.

Collapse
 
ashwinkhode profile image
Ashwin Khode

Just a small contribution to the community! Looking forward to do more

Collapse
 
wrldwzrd89 profile image
Eric Ahnell

The key takeaway from all this, for me is: Watch the Deno space, but if you're a Node.js user now, no need to take drastic action.