How Node.js Works

How Node.js Works
🔥Get the COMPLETE Course (45% OFF - LIMITED TIME): https://programmingwithmosh.com/courses/node

Learn and understand the single-threaded, non-blocking (asynchronous) I/O model in Node.js. 

Subscribe for more videos: 

Want to learn more from me? Check out my blog and courses: 

RRelated Posts

How Javascript works

How Javascript works is a must in understanding Javascript itself. Read more articles at

Tech Talk: Server Scaling in Node.js

In this video, Tim He talks about three performance problems you might encounter in your Node.js server and how to address them. Using the cluster and child_process modules of Node.js we can solve


  • Nicolas Cacace
    Asynchronous by default so you don’t have to do the work....ah yeah you do- in fact promises and later on the upgrade async were developed BECAUSE of all the work you had to do to allow it to run smoothly

    ....but, of course, you would know this.

    This video highlights something else about the world of programming - event based programming was doing this in the 70s so effectively it passed over everyone’s head until 2001
    I wonder what other processes used today (sitting under our noses) are just waiting to be pointed out (discovered)
  • Aradhya Tiwari
    How do I run node app on webserver
  • Keytron Quabius
    Also what are the difference between writing click events and functions in line in HTML and then writing them in the script only? Also how does that relate to Dynamic HTML is that just creating your own elements with JavaScript instead? Or something like a template literal? Sometimes all these big terms get confusing with what we are actually supposed to do pragmatically.

    Asking about dhtml because it's supposedly helps against scraping, and I'm wondering why
  • Keytron Quabius
    What does this have to do with read write and process.argv?

    I know I'm contributing to the whole newbie thing asking why arrays start at 2? And I know that's become like a popular joke to make fun of newbies with,
    But we all have to start somewhere, so what exactly is up with process.argv, or, what does it mean?
    I get that the zero value for the array is the command line tool itself and then the one value for the array is the program itself, but how does that sync up with our variables, read and write? What exactly are we supposed to do with all of that? I sort of get it, is that what multithreading is?
    Or is this like crud create read update delete? Like how we use the node command line to read and write files? What is the purpose of that? And where does the process object fall in and why are so many people teaching it that way?
    Is this something that all programming languages and their runtimes do? Is this something we should get used to for all languages? Do I I know for some people that can sound like the dumbest most newbie question ever but what's people figure that out usually they're on their way to becoming a good programmer, and that's one of the big hurdles they have to go over
  • jamie heiney
    Very clear, amazing video!!!
  • Fennec Ran
    The best video
  • Antonio L
    I love the way this channel explains programming concepts. I hope you make more videos like this explaining more JS concepts. OOP, IIFES, Etc...
  • archana mohanty
  • Just Aquib
    bucky's example... 😝
  • michael dalip
    good explanation but not true about.net
  • Saad Ali
    HAHAHA! Nice try dude. You copied it from Lynda.com.
  • sait cihangir Aldemir
    I dont wanna sound like a dick or something but this is actually how javascript works. Node is great but this async ability is not an invention of node.
  • Bruck
    Brando has electrolyte :)
  • Zdeněk H.
    await/async keywords were introduced in .NET 4.5 in a.d. 2012. Tasks (thread abstraction) even before. Only thing one had to do was to write async method, same as on node.js.

    Great and simple video, yet bit misleading regarding ASP.NET.
  • Sechaba Aapies
    Excellent explanation
  • Arunoda Samarasinghe
    Great Explanation Sir!!
  • BakePlay
    1:16 -> so the waiter... is... waiting? HAHAHAHA. ok bye
  • Michael Woodruff
  • Erik Bortscht
    It's sad that IO intensive applications are also not the most interesting ones.
  • Branko Zabala
    I love your animations... simple and to the point. What did you use to create them?
  • ill-fated Stranger
    Great explanation with short time
  • Suranjith Nishalaka
    very helpful. Thank you
  • Bootcodes
    understood like hell.thnk you very much..
  • An Sharma
    Nice explanation. Thanks
  • Aimilios Voma
    I love this guy (Ms.c) on web here
  • عبد القادر عبدالرحمن عبدالله
    A great overview for understanding what Node.js is all about before diving into action.
  • Akis Idr
    PERFECT! 4 min of pure education. You are the best!
  • Rodnas Zelaznog
    With ASP NET Core, async flow is there by default without you having to do anything. Plus, if you need to do CPU intensive apps, well you can do that as well without much effort
  • Антон Пегов
    Mosh hung in making cartoons. And they are cool )
  • Brian Bergh
    wow NODE.js works just like VB in the old 90s...... lol
  • Mark Deibert
    Uhhh isn't NodeJS single thread?
  • budkin
    The restaurant is the perfect analogy to non-blocking.
  • Octavio Herrera Hernández
    Hi Mosh, it's still worth learning .NET (asp.net mvc) or i need learn node.js instead? Thank you!
  • Hamza BEJAOUI
    Thank you :)
    Would you use Angular in front end in this course ?!
  • Wahabi Putra
    still waiting to released on Udemy :)
  • hadi mohammadi
    Hi Mosh. I really love your courses. They are easy to understand. Thanks a lot.
    I have a question for you. You said "When the database prepares the result it puts a message in what we called EventQueue". So for example if we call a query in Oracle, thread in Node will be released and it is the duty of Oracle to send back the result to the EventQueue after finishing its query, Is it right? If Yes, how Oracle can send the result to the EventQueue of Node?
  • chandrakanth Thadakapally
    Please provide node with typescript to compile and manage with Webapck and ts compiler . Can you also make with popular authentication library’s like passport js and jwt like works with private and public key and how to secure application efficiently
  • Noah Nobody
    Are databases usually synchronous or asynchronous?
  • 조형호
    I'm glade to wait this course but there is one thing I worried, it's little bit hard to understand because instructor's pronunciation. I think it's because English is not my mother tongue. Please consider this.
  • Duncan Firth
    Hi Mosh, i am at uni studying Application development and i want to get into .NET
    is this video .js front end? i am interested in learning about api's and some form of js front end. In .net this means webapi with dotnetcore or full framework and angular or react. What are your best videos and tutorials for this?
  • Muhammad ElHelaly
    The same angular example 😅
  • Mohammad Javad Hosein Pour
    Thanks, Mosh. Simple and data-intensive.
  • Mahmut Tiyek
    Thanks Mosh
  • St S
    Helpful for people working on other platforms that support Async programming. Thanks!
  • Parashurama Kulakarni
    Excellent! Waiting for course.
  • Анонимуси
    Enough already!!! Gives us the damn course! Fantastic quality as always.
  • ttma1046
    Isnt this “Event Loop” of Node.js but not async?
  • Christian Vásquez
    The hype is real
  • David Stania
    Very good Mosh! This kind of tutorials are very good to learn how it works!
  • DJOK1
    First woot