Learn Node.js Completely and with Confidence

Duration of Course: About 2 weeksPrerequisite: JavaScript knowledge of 5/10

This is the age of the JavaScript developer, and it will only get better, particularly because of the widespread adoption of HTML5; the abandonment of Flash; the ubiquity of mobile devices; the recent rise of Meteor.js; and the popularity, stability, and robustness of Node.js, which allows developers to use JavaScript on the server.

Node.js, a revolutionary technology, is the immediate and near future of modern web application development with JavaScript as the sole server-side language. In this article, I provide you with a comprehensive road map for learning Node.js; this road map has worked for me and I am confident it will work for you. You will learn Node.js completely and you should approach this course with confidence because you are only 2 to 3 weeks away from building impressive modern web applications in short time.

Can a Single JavaScript Course Make You Richer?

This Single JavaScript Course Can Get You a Bigger Salary(4 courses in 1—available as a single course for the first time)

Becoming a JavaScript Expert

Learn almost the entire
JavaScript language, advanced JavaScript programming, software engineering for web programmers, and more

21 comprehensive major subjects and over 200 of the most important concepts covered (plus a bonus advanced course)

Over 40 exercises and more than three dozen
projects and applications
(Watching and/or reading JavaScript [JS] tutorials alone won't help you advance your programming career; you need to build real JS projects and applications as you learn. These exercises, projects, and applications are the most important part of your JS training. They will advance your JS confidence and skills and your overall programming and software engineering skills.)

Every concept covered in depth and with clarity (if you don't understand something, we will
update
the course accordingly to add more clarity)

By JavascriptIsSexy: Support the website while you simultaneously save yourself thousands of dollars

Why Learn Node.js
JavaScript is the language of the web today and unquestionably for the near future because there is no known alternative to JavaScript in the works. The ECMAScript organization has been moving full pace ahead with advancing the JavaScript language.

With a solid understanding of Node.js, you will be able to use JavaScript to develop real-time, fast, scalable, data-driven web applications, and you will have the requisite knowledge to quickly adapt to any of the emerging, cutting-edge JavaScript technologies like Derby.js and Meteor.js. Incidentally, I have recently written a Learn Meteor Properly article and roadmap.

Unlike just a couple of years ago when you needed to know a true server-side language (such as PHP, Rails, Java, Python, or Perl) to develop scalable, dynamic, database-driven web applications, today you can do as much and more with JavaScript alone, as I noted in my Learn JavaScript Properly article.

How Not to Learn Node.js

Although a number of Node.js tutorials exist online, most lack the comprehensiveness necessary for learning Node.js properly. Moreover, you can easily spend a frustrating fortnight trying to find and discern the worthwhile tutorials from the fruitless ones. I read a good bit of Node.js tutorials when I learned Node.js a few years ago. I also wasted a good bit of time on many of them. I have done the hard work so you don’t have to go digging for Node.js tutorials.

Don’t go to Amazon and choose a Node.js book based on the reviews. Even though this is the customary way to decide on a book, because Node.js is still a new platform, most of the books don’t have a large enough sample of reviews to provide you with a clear picture of the book’s usefulness and value. And collectively, the reviews are not great.

If you go to Amazon.com and type “Node.js,” you will see at least 21 Node.js books. While I have only read five of them (the five best of the lot), I found a pattern in the books that were not good: the authors do not appear to have a vast and rich understanding of the Node.js architecture and platform, and the books appear to be a collection of mediocre tutorials aggregated for the book. Of the five Node.js books I have read, two are good, though I recommend only one. The two worthwhile books are Professional Node.js: Building JavaScript Based Scalable Software, by Pedro Teixera; and Smashing Node.js: JavaScript Everywhere, by Guillermo Rauch. I recommend Pedro Teixera’s book, but you can learn quite a bit from Guillermo Rauch’s book, too, so you should get both, if you are serious about developing with Node.js

Book Review
As of this writing, there are only two reviews of Professional Node.js: Building JavaScript Based Scalable Software (Pedro Teixera’s book) on Amazon.com; one of them is excellent (5 stars) and the other is a bad review–it is best if you read it yourself. This is the bad review of the book:

I have no idea if this book is well written or not because the formatting is so bad as to make it virtually unreadable in some places.

Obviously, the author of this review has not read the book and his review is completely about the formatting, which I have not experienced. I would give the book 5 stars because it is by far the best Node.js book I have read.

Also note that I know neither of the authors of the two books I recommend in this article.

Resources

Get a copy of The Node Beginner Book by Manuel Kiessling. It is a tiny book: it is really a Node.js tutorial. The book sells in a bundle with another book, Hands-on Node.js written by the aforementioned Pedro Teixeira, for $9.99. But interestingly, I didn’t find the companion book (by Pedro) to be as useful, so you don’t need it and we will not use it in our study of Node.js. But since you get both books for $9.99, take the deal and run. Get the Node Beginner Book here:

Read chapter 1 of Professional Node.js and follow the instructions on how to setup Node.js on your development computer.

Read the entire Node Beginner Book. As I noted above, it is a tiny book; basically a tutorial. This tutorial will give you a gentle introduction into Node.js and a very basic understanding of what Node.js development involves. It is good to start with this before you read the rest of the Professional Node.js book.

Read the entire Part III section (chapter 7 to 15) of Professional Node.js .

Optional: If you have got the Smashing Node.js book I referenced earlier, read chapters 8 and 9.

Read chapter 17 to 22 of Professional Node.js .

And finish up by reading the last 3 chapters of Professional Node.js .

Now that you have learned enough Node.js to build the backend of a modern web application, you have to learn Backbone.js, Ember.js, or Angular.js so you can rapidly build web applications on the frontend. You are a Node.js developer if you know only Node.js, but with oen of the noted front-end frameworks and Node.js, you are a badass JavaScript developer with the skills and tools to build all sorts of web applications. Go learn Backbone.js completely, or learn Ember.js or Angular.js.

With a complete understanding of Node.js and Backbone.js, you are ready to build any type of web application. You can build a startup at this juncture, if you are intrepid enough.

But before you head off for your adventure, build the NodeApp web application at the link below; this exercise provides you with a real-world practical in Node.js/Backbone.js web application development:http://dailyjs.com/web-app.html

Further Learning: There are two more technologies you should learn to help consolidate your Node.js and Backbone.js skills: Handlebars.js for templating and MongoDB for database. Indeed, you have learned the simple Underscore.js template engine that comes with Backbone.js and you have learned a bit of MongoDB in step 10 above. But you have to learn Handlebars properly because it is more robust and feature rich that the Underscore.js template engine. Read my post, Handlebars.js Tutorial: Learn Everything About Handlebars.js JavaScript Templating.

And you have to learn more MongoDB (unless you are suing some other database) to build serious web applications. You can get my MongoDB book, which covers everything you need to know about MongoDB to build sophisticated web applications.

Final Words

Stay the course until you complete the entire road map. Don’t give up. And don’t take longer than three weeks to complete it.

Twitter led me here. There’s wrong link : for “entire article” in point #5. Didn’t finish reading the article and didn’t start reading “Professional Node.js”, but your approach seems nice and I DO want to master Node.js, Backbone and the other stuff mentionned. Thanks for the pointers. !

Hey great article. Nowadays we have everything at our fingertips, yet we don’t know in which order to digest it since its so much. Showing a basic path on achieving things and limiting the consumption is crucial, thanks.

Hi Richard,
Thanks a bunch for the blog, it has been very helpful. I had a question regarding your e-commerce app. Are you using some kind of CMS for your client? From what I gather node doesn’t have any mature CMS yet. Anything I don’t know about? The project I am working on has a lot of products, therefore I value a good CMS very much… Anyways, I guess I am just wondering if there is a good CMS solution for e-commerce in node.js?

I am not using a CMS for that app, but I did offer to build one for the client, which they did not want at the time, since they only sell one product.

I have not seen any Node.js CMS either, but to add CMS functionality in the eCommerce app I created would not have been too difficult, although it would have been specific to that eCommerce app and not versatile like most open source CMS solutions.

Richard I have a vps with nodejs installed, Now I am trying to get a site built with node and express up and running, what do I need to do to get it up and running? I have my nameservers pointing at the url but I can’t seem to keep an instance running, and I don’t want the URL to be something like this:
domainName:3000
Can you point me in the right direction or make a tutorial?

For the installs, you can modify the install directory to /opt/node
You will need an initscript, instructions can be found here: https://gist.github.com/715255
(have to modify certain parameters to match your configuration)

Thanks a bunch Richard, I’m actually doing pretty good. I have node, npm , git, basically a LEMP stack set up with PHP5.4 and a postgreSQL and a mySQL set up for good measure and mongoDB to take care of the noSQL side of things. This is a great learning experience for me, working on setting up NGINX reverse-proxy for the nodejs application. I will be able to host up to 18 sites on this puppy.

1. What is the value of a database system over a JSON file and AJAX?
2. Are server applications (something like a server.js node file) executed? If so, how do they live with any permanence?
3. Do I need a unique port number for my application?
4. It seemed from my knowledge of Backbone that much of what Node does could also be accomplished in a different way with Backbone: is this true? What does Node do that Backbone can’t?
5. If I install Node on my developing computer, do I also need to install it on whatever server space I’m using? (I’m just using the space Columbia allots us…).
6. Where can I read about the web stack, abstracted from any language? I don’t think I understand it.

With a database system, which is relatively simple to use these days, especially with NoSQL databases like MongoDB, you can store data in a structured manner and with relationships, and you can access all the contents in the database and perform queries, additions, and updates, and you can perform searches (including optimized searches with indexes) rather easily.

I can literally type another 20 or 30 advantages with databases over a JSON file, but you get the point, a file has no match against a database. Note that you can easily use AJAX with a database, which I am sure you are already aware of.

2. Are server applications (something like a server.js node file) executed? If so, how do they live with any permanence?

Excellent question. They are executed on the server by the node.js engine, which was built on C++, btw. The reason the files remain as JS files permanently is because they are not destroyed or compiled over, they remain on the server in their pristine state, just like any PHP, ASP, Java, and other server-side language files.

3. Do I need a unique port number for my application?

Yes.

4. It seemed from my knowledge of Backbone that much of what Node does could also be accomplished in a different way with Backbone: is this true? What does Node do that Backbone can’t?

Another great question.
You can acutally do quite a bit with Backbone.js alone, even without a server side REST API or database, by using localStorage to save data. But a server side language is best used to store data permanently in a database and to secure some aspects fo your code. As you would imagine, you wouldn’t want to have all of your code available in the public domain for easy access, and you ceratianly don’t want to store all your valuable data (on your users and other important matters) in every user’ browser, where it can be easily deleted, viewed, and compromised.

5. If I install Node on my developing computer, do I also need to install it on whatever server space I’m using? (I’m just using the space Columbia allots us…).

Yes, when you are ready to run your Node.js application online, you will need a server running Node.js. Heroku offers free Node.js hosting and it is super easy to push your entire Node.js app from your local computer to Heroku server with just a couple git commands, and the entire app will be available online with a URL and hosting for free—until you get a ton of traffic and start using a lot of server resources. Then it gets quite costly .

6. Where can I read about the web stack, abstracted from any language? I don’t think I understand it.

Thanks for the great replies. Some clarifications, and further questions:

1. Regarding the web stack, and expanding on my question about executability: What defines a server computer, as different from the file location where I store the HTML and client-side scripts for the web page?

2. How/where do I get a unique port number? In all of the tutorials we use, they arbitrarily pick 3000 or 4000 or so. What does this mean? Since I’m using the localhost, couldn’t I just pick, say, 5?

3. More specifically into Node: most of the examples of EventEmitters have the same objects emitting and listening to the same event (i.e. someObject.on(‘someEvent’) etc and someObject.emit(‘someEvent’) etc ). Does this make sense? I would have thought the advantage to EventEmitting was that many different objects could listen to the same events, and wouldn’t themselves need to be emitters.

Again, thanks so much for such a great resource. (I’ve attached my embarassing little site – coded a couple of months ago, when I had really NO experience in this. Maybe that will help with context).

Hey there, I’m pretty excited about the copious amount of JS goodness on the site, and the thorough nature of these tutorials.

I’m going through the this step-by-step node guide, currently reading Professional Node.js, but I’m surprised to find a lack of any actual exercises to go along with the material. I’m skeptical that all this reading with no doing will leave me feeling all too capable on the other side. I can certainly do my own experimenting, and will, but I think a guide such as this would be all the more valuable if it directed to some exercises that illustrated the concepts in the chapters.

I agree with Anthony, the web app series on DailyJS is very good. However, I noticed that it does not always explain all the fundamental bits you need to know, so it is best to follow that series after you have at least learned the basics first.

Unbelievably valuable post. Very nice work with this blog. I have read most of Doug Crockfords info and this is right in line with his instructions. Thank you for talking the time to share with folks trying to grasp node.

I have an express server, which renders a page using handlebars, and a mongoose connection to the server. My front-end is written in Backbone, and works great. My collections are able to fetch data from the server fine, which send them back as JSON.

What I’d like to do: on the initial page request, make a brief call to the server and bootstrap 50 model instances onto the initial page. I’ve got it down to this problem: the response.send method in express automatically encodes objects as JSON, while the response.render method doesn’t. And – stupid as this seems – the server is crashing when I call .toJSON() on an array of mongoose model instances.

Any ideas for bootstrapping objects onto the page using mongoose, express and handlebars?

So it appears your trouble is with serializing (converting the data from an object to a JSON string) the results from Mongoose.

If this is correct, then you should use this:
JSON.stringify

Don’t use this:
toJSON

Also, and most important, you should ask a question like this on StackOverflow for quick and high quality responses, and you can post your entire code there easily, too. Those guys are super helpful, and you can get an answer within seconds or minutes after you post your questions.

All of your tutorials are really helpfull, but i really wanted a good guide for learning node… i bought a book called “Building Node applications with backbone and mongodbr”, and even with my previous PHP and MySQL experience, i found it quite hard to understand, because it mixes all 3 in one.. and the book doesn’t really explain all the features it says in the book…

well, do u think that’s a good book for begginers with node and backbone? or i should try your tutorial?

This sites looks awesome. Heard about it from listening to Java Posse Podcast and someone mentioned it. I have just gone thru the Node Beginner book online and came into a free copy of the Node Cookbook from Packt, but I think I will follow the path you recommend. Been doing backend stuff for well over 10 years but really want to sharpen my JS skills.

This says that one needs Javascript knowledge of 5/10 as a prerequisite. I am unsure of what that means, so could you please clarify.

I am also wondering how one would go about learning other web development techonlogies, such as HTML, CSS, and jQuery, because I want to create web apps. I want to create my own blog as my first web project and have heard that Ruby on Rails is also great. Just wanted your input. Thanks for the advice in advance.

Hey richard i have completed your guides (javascript,backbone and node), but still i dont feel like i know enough, the dailyJS web app is not so relevant for today (its 3 years old). and im having abit confusion with the backbone and node, i know node can be just for transfering data from the DB to the client, but there are alot moref fetures that can be used for example: rendering, you can render either with backbone or with node (using express, just point to the route and in the route use response.render (“your html page”,{ optional object data}). should i render using server? or using the template option in backbone? should i use backbone routes or should i use node routes? there are alot of things that gets blury when using those two togther, please help me understand what actions prefered to work on the serverr side on what on the client side.
thank you in advance!

I am very proud of you for having completed those 3 tracks (JavaScript, Backbone, and Node).

I understand what you mean when you write that you don’t feel like you know enough. I usually have that problem, too. There are people like you and me who prefer to learn everything about a topic before we feel very confident with it, which I must admit is not always the best method for learning.

Indeed, there are many advantages to being this way: you become very knowledgeable and when you start coding, you know exactly what you are doing. But on the other hand, it requires much more time and effort to get rolling when you prefer to learn a lot first.

So, since I usually have this problem, this is what works for me when I feel like I read a bunch and still don’t feel like I know everything: just start building stuff.

You will find that as you build stuff, you will then discover what you really don’t know and you will Google (or search StackOverflow) for help and become more and more familiar with the overall concepts and processes.

should i render using server? or using the template option in backbone?

There have been some very vibrant discussions about this from various authors and developers, with some making strong arguments for both. The bottom line is that it is much faster for the browser to render client side, so use client-side templates. Not to mention it is much easier to manage all your templates on the frontend.

should i use backbone routes or should i use node routes?

Another good question. There are times when you need to use one over the other, depending on the particular circumstance. But for the most part, you should go with Backbone Routing. The Node routing is best for serving up static content in your public folder and for serving up private content from the server that you don’t want to keep in the public folder. And of course you can restrict certain URLs to your app as well using Node routing.

For normal application interaction (including simple navigation to different parts of the app), Backbone.js routing should be the choice.

Just start building stuff and when you are stuck, use StackOverflow to help you out. You will learn a lot.

You are an inspiration, Mate. I am confident that within a few months to a year, you will figure out all this stuff and become a very good developer. And you might even come back and provide answers and recommendations to us here, with your new found experience and knowledge

Thanks Richard,
really helpful advices there, thank you for the motivation!
by the way there is an extra guide part for the wine cellar that you can add to the backbone guide (http://coenraets.org/blog/2012/10/creating-a-rest-api-using-node-js-express-and-mongodb/) he changed the backend to work with node.js and mongoDB, so if you follow the two parts of the his backbone guide and also the backend guide youll end up, with fully single page app using backbone node and mongoDB

Hey Richard,
i couldnt noticed Meteor.js, the idea of having the databae in the client i just awesome!
i know your working on a new post for learning meteor.js,
but untill then do you have any recommendation on a certain book? i got the “getting started with meteor.js framework” book but im thinking of buying the “Discover meteor”.

Thanks for this excellent guide – I’ve eagerly started and just completed the Node Beginner book. It was a great suggestion.

I did run into one problem in the final exercise which I was able to overcome. Anyone who follows the book exactly will run into this problem and I figured they might turn here for help, so I’d like to share my solution, which I’ve posted as an answer on Stackoverflow:

You should go directly to meteor.js. But if you have a lot of and you want to learn the process throughly, you can learn the Node.js basics, which will allow you to have some idea about Meteor.js. But if you are busy, just learn js then learn Meteor.js.

I am really enjoying your depth of JS tutorial and I am stumbled upon the insight knowledge you share with open world and the steps you teach them the crux of new technologies like Node.js and Backbone.js. I am really impressed. I have also pointed some of your resources for stack over flow references. It shows how much your articles are well articulated and clearly teaches everyone.

Excellent beat ! I would like to apprentice while you amend
your site, how could i subscribe for a blog
website? The account helped me a acceptable deal.
I had been a little bit acquainted of this your broadcast offered bright clear concept

I really like your blog.. very nice colors & theme. Did
you create this website yourself or did you hire someone
to do it for you? Plz reply as I’m looking to design my own blog and would like to
know where u got this from. appreciate it

All your articles are awesome!!! I was just wanted to mention nodeschool.io and Mixu’s node book (http://book.mixu.net/node/). They have both been valuable resources for me while I’ve been learning node.

hi Richard, I competed your learn javascript properly course and your backbone course. Before that, I was a total beginner programmer. I’m reading through the Professional Node book, and it seems like one needs previous knowledge in working with the command line to fully understand a lot of the concepts. Thus, I feel completely lost even though I’m on chapter 8 of the book. The only command I know is “cd”, which of course changes directory lol. Do u have any recommendations of where I can learn this basic stuff before I try to read more of the book and confuse myself further? I read the whole beginner book that u recommended and for the most part understood it. Thanks in advance!

Hi and thanks for a great blog! I’ve been following your javascript course with great success for a project I’m working on. Now I’d like to keep learning on my spare time, but I’m not sure about whether to turn to Node.js or Meteor first. My goal for this summer is to develop a simple app, so Meteor would probably suffice. Eventually I’ll want to do more complex stuff and learn Node.js, so maybe I should just go ahead an get started with that. Would you say that knowing Node.js helps my understanding of Meteor a lot?