You are on page 1of 5

5 NPM Modules Every Node

Developer Needs
J. Stashewsky

Tweet

25

SHARE

Like

At GoInstant we use a ton of NPM modules (NPM is the Node.js package manager, and
npmjs.org is the home of thousands of insanely valuable modules), and we wanted to
share some of those with you, and why we use them. Turns out it wasn't easy to narrow
down the list! It caused a huge debate internally (OK it was a flat out argument, and there
may or may not have been Nerf guns involved), but we eventually figured it out.
Here are 5 NPM modules that we rely on extensively, and think every Node developer
can benefit from. (There's a host of "runners up" at the end as well.)
5. optimist
Coming in at #5 is optimist. Compared to commander, we like optimist because of its
flexibility. It plays nice with prompt, too. Together, we use optimist and prompt to make
handy command line tools for development and deployment. Our DevOps team swears
by this, and threatened us with downtime if we didn't include it ;)
4. mocha
We use mocha as our primary test framework. At GoInstant, we're obsessively focused
on creating test automation, so we can move quickly during development. We previously

used vows for server-side testing and jasmine on the client-side. We switched to mocha
in order to minimize the cognitive overhead of having to use two test frameworks. Plus,
we like that mocha is still BDD like vows (BDD = Behavior Driven Development, which
basically means using a requirements-oriented syntax as a way to structure tests), but
that it's much easier to understand up-front (less magical).
3. sinon
To further our test-focused development culture, we use sinon (website). Sinon is
excellent for keeping test units focused; stubbing out external dependencies is easy to
implement and clear to read afterwards. Plus, the great assertions (e.g.
sinon.assert.calledOnce) allow us to check the internal interfaces of each of our
modules, which is almost as important as the external interface (API) in many cases. Plus,
we find the sinon fake timers are extremely useful in testing protocols that involve
timeouts, retry-delays, etc.
2. lodash
Despite the fact that Node.js has great built-in utilities, we find that the brevity and utility
of lodash helps maintainability. We switched from underscore.js to lodash after
discovering some very hot code in our realtime back-end, and got a significant
performance win. We never looked back. Since we also use lodash client-side (it's highly
portable), it lets us use great functional-programming paradigms like _.map without
having to worry about if Array#map() is present! Also, the lodash documentation is
excellent--awesomeness we hope to emulate in our own docs.
1. async
By far, the most often used module at GoInstant is async.js. The main reason is because
of how useful it is in dealing with callbacks (Continuation Passing style). Day 1 training at
GoInstant includes an in-depth tutorial on how to use async properly, which greatly
eases the often painful switch from threaded environments to the event-oriented,
callback world of Node.js. It runs client-side just as well, so just like lodash and mocha,
it's great for reducing cognitive overhead.

While these are five awesome modules that we wanted to highlight, we depend on far
more than that. Let us know your favorites in the comments.
Honorable mentions:

traverse - pretty sweet substack module, made to walk objects


jshint - our code base would be a mess without it!
mocha-phantomjs - one of our testing frameworks backbones (testing client-side
code on the command-line is great for productivity)
express - the de facto web framework
engine.io - we see this as the more useful successor to socket.io
pg - an impressively well done and solid PostgreSQL module
bcrypt - never leak saved passwords!
redis - mature and reliable, we depend on this heavily server-side.

3Comments

GoInstant

ChromonavKulka
Share Favorite

SortbyBest

Jointhediscussion
Neamar 5monthsago

Whenusingasync,especiallyasync.waterfall,ifound
https://www.npmjs.org/package/...tobereallyusefulforcontinuationfunction

Reply Share

JimWelch ayearago

AsaNode.jsnewbie,(butprogrammingfor40years),isthereagoodwaytolearn
whatpackagesareinnpm?Bytags?bycategory?Wordofmouth?

Reply Share

DaveKim

Mod >JimWelch

ayearago

HeyJim,theconsensushereatGoInstantisthatwordofmouthisthebest
waytolearnaboutnpmpackages.
BywordofmouthweincludeGitHubStars(MostStarred)andtheMost
DependedUponlistsathttps://npmjs.org/
Also,here'sareallycoolgraphofnpmTopPackagesDependencies
http://visualizing.org/fullsc...
Hopethathelps.

Subscribe

Reply Share

AddDisqustoyoursite

Privacy

You might also like