Resources for Getting Into NodeJS

by Eric Terpstra on October 16, 2014

The modern web is always changing, and this article is more than two years old.

Eric Tersptra provides some guidance for getting started using Node.js.

Node.js has exploded in popularity since its relatively recent introduction in 2009. A plethora of books, videos, courses, and articles have been released detailing the ins-and-outs of creating applications with Node.js. In fact, there are so many resources available, it’s difficult to know where to start. This difficulty is compounded by the fact that Node.js development is still moving very quickly, which means many of the results that pop up in a Google search may already be outdated, or not very beginner friendly.

In my (currently ongoing) journey to learn Node.js, I’ve traversed dozens of sites looking for relevant beginner-level material. In this article, I’ll do my best to present what I think are the best up-to-date (and free) resources for getting into Node.js.

nodejs-wallpaper

Fundamentals First

We’ll start with a few basic questions…

What is NodeJS?  The folks at Modulus have a good answer with their article, An Absolute Beginner’s Guide to Node.JS.

Why should I use NodeJS? Toptal author, Tomislav Capan presents some compelling cases in Why The Hell Would I Use Node.js? A Case-by-Case Tutorial

What if I’m a visual learner? No problem, these screencasts are oldies, but goodies: NodeCasts. Also, CodeSchool offers the first lesson of their Node course free of charge.

Is there anything I can read on my commute? If long-form reading is what you’re after, take a look at Max Ogden’s Art of Node on GitHub. It’s fairly recent and very digestible. For more textbook-like experience, check out Node: Up and Running from O’Reilly, or Mixu’s Node Book online. These are showing their age a bit, but still worthwhile.

Head to School

Hopefully by now you have Node.js and Node Package Manager (NPM) installed. If not head over to NodeJS.org and hit the green Install button. A working version of NodeJS and NPM gives you access to one of the most popular learning resources to date – Nodeschool.IO.

NodeSchool Logo

Nodeschool is put together by an organization of volunteers that have created an interactive platform for distributing lessons related to the Node.js platform. They also assist and facilitate in-person Nodeschool events around the world. It’s pretty great, and more topics and materials are added to the platform every few weeks.

The best place to start for a beginner is the Learn You Node set of lessons. The current incarnation of the Nodeschool site has details on the interactive courses about half-way down the page. The full source code for the project can be found on GitHub.  To get started immediately, open a terminal window and type in the command: npm install -g learnyounode. If you are on a Mac, you may need to add sudo to the beginning of that command. This will install the learnyounode package globally, which means it can be run anywhere from your command line.

See Also:  How Microservices Saved the Day: Sean McCullough on Explosive Growth at Groupon

Once learnyounode is installed, create an empty folder and navigate to it in your terminal window. Run the learnyounode command to get started. The first lesson will instruct you to create a javascript file with a single line of code. Follow the instructions and save the javascript file into the folder you created. *You must run the learnyounode verify yourfilenam.js command in the same folder as the javascript files you create.

Learnyounode Installation Screenshot

The exercises in the set range from very easy to slightly tricky, but be persistent. There are discussion forums online in case you get stuck. If you are lucky enough to live in a city that actually has a live Nodeschool event happening, I highly encourage attending!

For a good, free text editor to assist with writing Javascript, I recommend Brackets from Adobe. It is built for front end coding in HTML, CSS and Javascript, but can just as easily be used for NodeJS without any extra plugins.

Dive into the Core

The material above should be enough to provide a good understanding of Node.js and its capabilities in a broad sense. There are a few key features of Node.js that do warrant special attention. These are the event loop, modules, and streams. It’s possible to learn about these topics in the official Node.js documentation, but there are also a few good articles and resources out there that provide a more gentle introduction.

Events and the Event Loop: For a short but sweet explaination with a few comparisons to other languages, see Understanding the Node.js Event Loop from StrongLoop. A slightly more involved explanation from Mixu’s Node Book is pretty good, too.

Streams: Streams in Node.js are wildly powerful, but can be daunting to the uninitiated. The Streams Handbook from Substack is the de-facto resource for getting started. Our pals at Nodeschool.IO have an interactive course specific to learning streams called stream-adventure. Another interesting project is the Streams Playground from John Resig (creator of jQuery).

Modules: The introductory material introduced the topic of modules, but creating your own in the real world can get a little hairy, as no particular structure outside of the CommonJS structure is enforced. A couple good articles outlining design patterns for creating modules in NodeJS can be found at GoodEggs.com and the blog of Mario Casciaro.

NPM: An overarching theme in Node.js development is to create many small, single-purpose modules and compose them into functional pieces of software. The community has taken this ideal to heart and literally created tens of thousands of freely available modules on NPM. It can be almost impossible to figure out which modules to select at first, but a wonderfully curated list of modules can be found on GitHub in the Awesome Node.js project.

See Also:  How Cars.com Developer Mac Heller-Ogden Convinced His Bosses to Adopt Node.js

Get Writing Some Node

When getting started with NodeJS (or any other language), it helps to reach out to others with questions, or simply share what you have learned online. Or perhaps you run across some code that you want to try quickly without the need to fire up a text editor and run it locally. Two quick and easy service for this are JsApp.US and Runnable.com.

For a more powerful and robust online editing experience, Cloud9 is easy start with and has a ton of awesome features. It even includes a debugger to step through your NodeJS code.

The best (in my opinion) option for writing Node.js apps locally is with WebStorm from JetBrains. It’s a paid product, but it does have a free 30-day trial. There is often a free early access (beta) version available to use without limit as long as you keep updating to the latest patch release.

The aforementioned Brackets editor from Adobe comes with an extension called Theseus, which enables live JavaScript debugging which can be useful when getting started with NodeJS. It’s a bit experimental, but free, and there’s a good overview on the Brackets blog.

If you want to stick with your own text editor, but still do some live debugging of your code, then take a look at the node-inspector package. It’s a stand-alone debugging tool that utilizes the Blink Developer Tools (similar to Chrome DevTools). Ido Green has a nice post about getting started titled, Debug NodeJS Like A Pro.

Get your Node app Online

If you get so far as to creating an app that you want to publish online, then Heroku has a free tier that will allow you to do just that. For a more tailored hosting experience specific to Node.js apps, it’s worth checking out Nodejitsu and Modulus – each of whom offer a free month trial period.

If you want to experiment with setting up your own server and rolling your own Node.js environment online, then Digital Ocean has a pretty great set of tutorials, plans that start at USD$5 per month.

Stay Informed!

The Node.js community is large, and very,very active. A few good places to plug in are:

And, of course, the official NodeJS and NPM blogs.

More, More, More

We’ve just scratched the surface here, and there is plenty more to discover. Hopefully this article has provided a good jumping off point to getting into NodeJS and thinking about how you might use it to create something great. There is plenty left to discover, including web frameworks, open-source applications, build tools, and even desktop software all created with NodeJS.

If this wasn’t enough, a few more lists-of-NodeJS-things can be found on Stack Overflow and GitHub. Have fun, and happy learning!