Update: If you like this post, you may also want to check out my “Node.js App Basics” series.
Getting started with node.js can be somewhat challenging. This is not because there’s anything intrisically difficult, but the culture and community is actually so prolific that it’s difficult to know where to start.
In my node.js adventures, here’s a few tools that I have found to be critical, and save me loads of time.
This one is so core, it’s actually included with the node.js installer. If you’ve done development in any mainstream language, you’ll recognize and appreciate this one right away. “NPM” stands for “Node Package Manager”, and it has a few design characteristics that actually make it work better than many of the package managers you’ve used, including: * RubyGems * Nuget * Pypi
Grunt does your, ahem, grunt-work. Using grunt, lots of standard build-time tasks can be achieved. For example: * JS can be linted and minified. * Compile/minify your LESS/SASS/CSS. * Run Unit Tests * Copy/package assets * Pre-compile templates to JS (if that’s your thing). * “Compile” coffeescript / typescript / tracuer
Grunt can be configured to run your set of default tasks each time you type this:
But, using “watch,” Grunt can also monitor sets of files and perform specific tasks when things change (this is a great way to speed up the feedback loop).
Node is great for simple one-off scripts, but many people are finding that they want to use it for web development. I think this is a great use, as there are many cheap/free hosting solutions to get people started, but also that you can learn JS/CSS/HTML and be on your way to developing a complete web-app (rather than needing to learn JS and Ruby/Python/C#, etc.)
Supervisor will monitor a folder and start/restart a node process when anything changes. I have this started with Grunt, so that I have my node process restart when I save changes to the server files, as well as monitoring files that I need minified for the client.
Installing supervisor is simple:
$ npm install supervisor -g
And using it is now just as simple as this:
$ supervisor server.js
Supervisor will now monitor js changes in the current directory (and sub-directories) and then restart the server.js file when they change.
A good terminal.
While I am sure it’s possible to get pretty good with node.js (and dealing with packages/etc.) without a good terminal, I think it’s likely that you’ll be missing out on many time-savers by doing so.
I have never really liked any of the terminals in Windows, but some people talk a lot about Console2
If you’re using Linux, you probably already have experience in a terminal, and could care less about my suggestions.
Git has grown incredibly in popularity over the last several years, and it’s actually a great tool to help with your personal software process, regardless of which version control systems your employer/clients require you to use.
Getting some basic git knowledge is not required right away, but if you get serious about node.js, you will end up seeing/wanting to know a bit about git.
If you plan to deploy to Heroku, Nodejitsu, Azure, or Joyent, you’ll need to know a little bit of git, sooner or later.
A *nix Package Manager
Node.js is able to talk with many different technologies, and having a complete development environment where you can work disconnected is incredibly valuable. No wi-fi? No Problem.
Package managers allow you to easily install services on your dev machine, and in production environments.
As I have mentioned in the past, I really have loved OS X and my mac for many years. The combination of It Just Works ™, and the ability to get some *nix functionality has really made it an incredible environment for development.
A few years ago “homebrew” was introduced to the world, and installing packages on OS X from source has never been easier:
$ brew install couchdb
If you’re a developer on OS X and don’t have this installed. Do this now! You will thank me.
If you’re on Linux, you might have rpm, apt, yum, or some other package management, again, you’ll need to get to know these tools, as they will help you immensely.
Again, I am not sure if there’s a great analog on Windows, but perhaps the closest is cygwin, which is “Better than nothing.”
A good text editor
Some folks love notepad.exe.
Some folks love vim.
Some folks love sublime text.
Regardless which you love, a good text editor that can do some of the work for you is essential. At a minimum your editor of choice should have the ability to do syntax highlighting/format blocks. Everything after that is icing.
Each of these is worthy of its own post, and I am leaving many of the tools in the chain out, but hopefully this will provide a bit of direction on where to get started.