What is NodeJs? Pros, Cons and Use Cases
Tags: node, javascript, webdev
Published: 2020-05-02 14:32:07


<b>What is NodeJs?</b>
If we go by the official definition of NodeJs then, "It is a Javascript runtime built on Google Chrome V8 Javascript engine." But what does this even mean? And what the heck is a Javascript runtime? and what is the Javascript engine? Let's learn this one by one.

<b>What is Javascript runtime?</b>
A Javascript runtime is a place where our Javascript code is executed. It is like a container or an environment where our JS code is executed.

Probably you have written Javascript before. Whether you have written vanilla Javascript or used frameworks like Angular or React, you have written Javascript before and executed your code inside of a browser. The browser understands and executes our code and displays the result. In this case, the browser is the place where our Javascript code is executed. So our browser is the Javascript runtime here. But the browser is just the place where the code is executed. It uses a Javascript engine to execute the code. Now, let's talk about that.

<b>What is the Javascript engine?</b>
A Javascript engine is a program that executes JS code inside of a Javascript runtime. Every Javascript runtime uses a Javascript engine to execute JS code. Chrome browser uses the V8 Javascript engine which is built by Google. Mozilla Firefox uses Spidermonkey to execute JS code inside of Firefox. Internet Explorer uses Chakra to execute JS code.

<b>Now, What is NodeJs?</b>
So NodeJs is a place where our Javascript code is executed. It is like a container or an environment where our JS code is executed. It uses the V8 Javascript engine to execute the JS code. The V8 Javascript engine is the same engine that is used by the Google Chrome browser to execute JS code.

The NodeJs takes javascript outside the browser and executes it. It allows us to execute JS code outside the browser. And it also removes the restriction that comes with executing JS in the browser. We can do a lot more with Node than the browser. It gives us access to the filesystem. It can help us to build strong, secure, and scalable web applications.
Nowadays, NodeJs is the most popular tech which is used to build backend of a web application. It can also be used to build RESTful APIs. It gives us much much more.

The best thing about NodeJs is the community. Many many developers are using Node to build web apps, APIs, etc. So most of the problems that you will encounter have already been answered on Stackoverflow. It also has a huge library of packages which is very beneficial. You can use the packages in your projects to save a lot of time.
Now, let's talk about when you should use NodeJs? and most importantly when you shouldn't use Node?

<b>When you should use Node?</b>
Whenever you are building data-intensive applications, Whenever you are building an app that will have lots and lots of data then Node JS is the best choice. For example, Video- Streaming apps, chat applications, or any other realtime application.

<b>When you should not use NodeJS?</b>
Whenever you are building CPU-intensive applications, then Node is not a good choice. You should use another tech like Django, Flask, Ruby on Rails, etc. Node is not good for CPU-intensive apps or apps which require heavy server-side processing. Examples of CPU-intensive apps are Image manipulation apps, Video conversion apps, Video compression apps. Their apps require heavy server-side processing and thus, Node is not the best choice for building these kinds of apps.

Now, let's talk about the companies that are trusting Node for their apps.
Netflix, Uber, PayPal are some of the companies which trust and use Node for their apps.

Alright, this is enough for a very high-level introduction to NodeJs. If you want to watch the video version of this article then click on the <a href="https://www.youtube.com/watch?v=TjlzzHOzaeA" target="_blank" rel="noopener noreferrer">link here</a>.
<br>
Connect With Me:
Youtube: <a href="https://www.youtube.com/c/ShubhamSauravYT" target="_blank" rel="noopener noreferrer">ShubhamSauravYT</a>.
Twitter: <a href="https://www.twitter.com/hiShubhamSaurav" target="_blank" rel="noopener noreferrer">@hiShubhamSaurav</a>
Instagram: <a href="https://www.instagram.com/hiShubhamSaurav" target="_blank" rel="noopener noreferrer">@hiShubhamSaurav</a>
Facebook: <a href="https://facebook.com/hiShubhamSaurav" target="_blank" rel="noopener noreferrer">@hiShubhamSaurav</a>