A Quick Guide To Reading Node.js Core Source

  1. Make sure you understand Node.js a little bit. I mean, you know, do a few simple programs first before looking at core. Presumably, you’ve done that, so let’s move on.
  2. Start with the docs for APIs. Pick one you are particularly interested in and read through it. Or read through all of them. At the time of this writing, these documents can be found at https://nodejs.org/dist/latest-v5.x/docs/api/. Or you can read the markdown directly in the source tree at https://github.com/nodejs/node/tree/master/doc/api. Or you can read them from the `doc/api` directory in your local copy of the source code.
  3. There is an excellent chance that by now, you have found a small typo, omission, or other problem with the docs. Hey! This is an opportunity to get familiar with the Node.js contribution process. You can skip this step if you just want to understand the code only and not participate in the project. But otherwise: Read up on how to submit a change at https://github.com/nodejs/node/blob/master/CONTRIBUTING.md.
  4. Remember step 2 where you read some docs for APIs? Now it’s time to read the source for the API that interests you. Let’s say you’re all about `http`. Look in `lib/http.js`. When you come across stuff you don’t understand — what is `process.binding`? — look it up in the docs. Or ask on the #node-dev channel on freenode.
  5. Whatever you were looking at (let’s say `http`), now read all the tests for that in `test/parallel` and `test/sequential`.
  6. Take a peek at some of the dependencies in the `deps` folder. Which ones may depend on what you are interested in and whether you love or loathe reading C++. The ones that offer the most insight into how everything works may be `npm` (package manager implemented in JavaScript), `uv` (short for `libuv` which is a C library that Node.js uses to interact with the underlying operating system), and `v8` (the JavaScript engine that Node.js uses which is written in C++).



Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store