A Beginner’s Tutorial for Node.js

I’ve been spending some time learning Node.js.  Since there isn’t a clear definitive guide out there, I decided to put together a some of the best online resources I’ve found.

The goal of this tutorial is to bring a beginner fully up to speed with Node.  At the end you will understand Node’s eventing model and be able to create a site using the most popular modules and frameworks.  It should take about 4 to 5 hours total.

Prerequisites:  some knowledge of javascript in particular and web programming in general.


For those of you unfamiliar with it, Node is a server-side javascript framework for building scalable web apps.  It’s relatively new but has gotten tons of attention and is definitely worth a look.  I’m assuming if you’re here you’re already interested in taking a look, so I’ll dive right in.  If you want to know more about why you should use Node, see this article from the Register.

Getting Started

I’ve found that the most important thing for understanding Node is to realize it initially places an additional burden on the programmer.  In traditional web frameworks such as Rails or Django, you typically write methods to handle incoming requests.  Your method can call directly to the database or file system because it runs on its own thread — it’s allowed to take as long as it wants to return a response. The server can always spin up other threads to handle other incoming requests.  This makes the logic straightforward — the entire handler can be written in one method.

In Node, the entire server has one single thread, so now your code must play nice.  If any of your handlers call a blocking method, the entire server is blocked.  Your code has to be constructed so that it always returns immediately and is called again when a response from the database or filesystem is ready.  The difference from before is that the handler logic is split.  Understanding this difference is the key to understanding Node.  I mention this here because initially most Node tutorials gloss over this point.  Just keep it in mind.  It will become more clear as you start learning.

The Basics (1 – 2 hours)

Start with ‘The Node Beginner Book’  by Manuel Kiessling.   For me it was the best overall getting-started guide to Node.js .  It can be read online for free.  Read the book and follow along with the examples.  It’s a short, easy to read book.  The last section, on handling file uploads, can be skipped.

It also has instructions and a link to installing Node on your machine.  If you’re on Windows you can also find instructions here.

By the end you’ll know how to set up a server on your machine, create a simple web server, use modules to organize code into files, create a simple routing system for requests, and handle POST requests.  You should understand Node well enough to learn about some existing libraries and tools.

Bonus reading:  Look at chapter 3 of ‘Up and Running with Node.js’ for a more in-depth discussion of the event loop and why blocking it is bad.

Going Deeper  (1 hour)

Now that you know the basics of Node it’s time to go a bit more in-depth.  We’ll start by taking a closer look at callbacks and control flow.  Read chapter 7 of ‘Mixu’s Node Book’.  Optional: continue to chapter 8 for a review of modules.

When you’re comfortable with control flow read chapters 9, 10, and 11 to learn about the core API you’ll be using in all Node programs.  You can skim these a bit, since the book goes into detail, but just be aware of the APIs available so you know to look them up later.

One thing you’ll notice missing from Node are web framework niceties like a view / templating system.  Finding a Node web framework is the next step.

The Express Web Framework  (45 min)

To continue we’ll take a look at Express.

Express is currently the de-facto web framework for Node.  Start by watching nodetuts.com‘s series of videos on Express: episode 9, 10, and 11.  They’re about 15 minutes each and are a good intro to Express and the Jade templating language.

A Real Example (1 hour)

Time to look at a real example.  Read this blog post  and follow along.  It will show you how to create a simple blog site using Express as a web framework, Jade and Stylus for templating, and MongoDB for the backend.

Before you get started it might be helpful to take a quick tour of MongoDB.  It’s an interactive tutorial that takes only a few minutes to complete and helps provide context for the lesson.

Finishing up

Congrats!  You should now be able to create a ‘real’ database-backed web site using Node.  More importantly, you’ve learned enough to be able to continue learning on your own.

For this course I’ve tried to bring together the best content in order.  Any better resources out there that I forgot?  Please mention it in the comments!

List of resources mentioned in order

Other Resources

Chapters 5, 6, and 7 of Up and Running with Node.js have an overview of the Node.js core API.

Node Web Development is a decent overall introduction to Node.

The official Node documentation has a list of useful Node modules.

About The Author

I'm currently learning Node.js while playing around with various web projects.


  1. [...] Prerequisites:  basic node.js knowledge.  To get up to speed read A Beginner’s Tutorial for Learning Node.js. [...]

  2. [...] Everything should be working.   At this point you’ll want to walk through a guide such as A Beginner’s Tutorial for Learning Node.js.  Have [...]

  3. Jimmy Chu says: - reply

    I thank you for this beginner “reference”. What you mentioned is really useful to me and save me time on looking at various resources.

    Thank you.

  4. Zyah says: - reply

    I went to tons of links before this, what was I tihnikng?

  5. Corey says: - reply

    This was really helpful in getting me started. Thanks!

  6. [...] background-position: 50% 0px; background-color:#222222; background-repeat : no-repeat; } project70.com (via @del_javascript) – Today, 5:04 [...]

  7. [...] A Beginner’s Tutorial for Node.js : Node.js tutorials at Project 70 A Real Example (1 hour) [...]

  8. Matt says: - reply

    Hey, thanks, this was a great help for me.

  9. Divyanshu says: - reply

    Thanks mate… really gr8 advice… it helped me to smoothly integrate node.js, express.js, mongodb, jade and stylus…
    Saved me hours of searching… :)

  10. [...] introduction to Node. The official Node documentation has a list of useful Node modules. via A Beginner’s Tutorial for Node.js : Node.js tutorials at Project 70. Leaflet – a JavaScript library for mobile-friendly interactive maps by CloudMade [...]

  11. Fortune says: - reply

    Thank you for all the resources you’ve shared here. This is very helpful.

  12. [...] SourceURL: http://project70.com/nodejs/beginners-tutorial-node-js/ [...]

  13. Arnav Roy says: - reply

    nodetuts.com’s links for episode 9, 10 and 11 return 404. Any clues what the legit links are?

Leave A Reply

5 + three =