If you are new to Node.js then there is a strong chance that you never heard of its Event Loop. It is one of the core concepts of Node.js that you need to understand if you want to build production-quality CLIs. So in this article, I am going to talk a little bit about the Node.js event loop to give you a basic understanding.
The Node.js event loop gets triggered by whatever file is trying to run the Node.js. In our case, it is the
index.js file that has our CLI. And it will run a particular event loop. A Node.js process will begin and it will loop around a bunch of processes. When everything is done, it will go ahead and exits itself.
There is a great explanation about the Node.js process by one of its core contributors. I will highly recommend to check it out.
This is just an overview of the Node.js event loop. There is still a lot to it. So I would recommend you to read Node.js event loop documentation which you can find here.