Got GitHub Stats

Now our hand-picked registry of Node.js frameworks ( has GitHub statistics right on the website, so you don’t have to navigate back and forth when making a decision!

This is how it looks: each framework has a number (GitHub stars) next to its name. This serves as a social proof meaning the more people use the framework the more robust it is and the less bugs it has.

GitHub stats on

GitHub stats on

The buttons provided by the service called GitHub Buttons. The links to the frameworks’ GitHub, NPM, examples and other resources are hidden under the “i” icon.

Thank you Randson Oliveira for contributing and making pull requests!

Punishment for Becoming Better

Punishment for Becoming Better

If you do something for a living every day (i.e., you have a job) you have two choices:

  • Learn and become better: this is the default path for most people (it’s hard to do something over and over without getting better at it).
  • Stagnate and regress: this is actually harder than progress, and may require some subconscious proactive self-sabotage.

So everything is better if we automatically make progress, right? Not quite, because when we make progress, other people (including bosses) start to notice, and they then give/bring/order more of the same work—not a new type of work. Usually it’s the same stuff you’ve been doing already (and for the same money), because management doesn’t want to lose a good producer. I call this punishment for becoming better.

Continue reading

Node Octoberfeast: 5 Books for $9.87

Node Octoberfeast: 5 Books for $9.87

Node Octoberfeast deal is five (5!!!) books on Node.js and JavaScript plus an Express.js v4.x cheatsheet.. for just $9.87!!! Buy at

Hurry up—the deal expires on October 2 6pm PT, 2014!!!

The list of books as follows:

  1. Rapid Prototyping with JS: Agile JavaScript Development
  2. JavaScript and Node FUNdamentals: A Collection of Essential Basics
  3. Oh My JS: The Best JavaScript Articles
  4. Express.js Guide: The Comprehensive Book on Express.js
  5. Introduction to OAuth with Node.js: Twitter API OAuth 1.0, OAuth 2.0, OAuth Echo, Everyauth and OAuth 2.0 Server Examples

Buy them all at



Secret Express.js Settings

Secret Express.js Settings

Express.js is one of the top Node.js frameworks out there. It was used in the overwhelming majority of projects that I’ve encountered since I began working with Node.js in 2011. One of the main selling points and key differentiators is the framework’s configurability. However, while writing Express.js Guide and Pro Express.js, I discovered a few secret settings never mentioned in their documentation (Figure 1).

These undocumented settings are:

  • json spaces
  • etag
  • query parser
Figure 1: Documented Express.js Settings

Figure 1: Documented Express.js Settings

Let’s take a closer look at each one of them. This article is applicable to Express.js versions 3.x and up to 4.8.1 which is the latest as of this writing.

json spaces

When you use the Express.js’ method response.json() to send back to the client’s JSON data, you benefit from special parameters: replacer and spaces. The former is documented on the website while the latter is not. Under the hood, these parameters are passed to the JSON.stringify() function (MDN docs). JSON.stringify() is a widely used function for transforming native JavaScript/Node.js object into strings.

The spaces option modifies JSON output exactly as described in the stringify() documentation—“Causes the resulting string to be pretty-printed”. For example, you can set the spaces value to 4 to indent each level with four spaces:

// ... Express.js app instantiation 
app.set('json spaces', 4);
// ... Express.js app routes

The statement above will produce indentation as shown in Figure 2.

Figure 2: JSON output with replacer and spaces set

Figure 2: JSON output with replacer and spaces set

On the other hand, when you use response.json() with default settings (probably to minimize the size), the output will look less readable (as shown in Figure 3).

Figure 3: JSON output without spaces set

Figure 3: JSON output without spaces set

My opinion is that spaces set to 2 can be used when the application is in development mode (app.get('env')=='development').


ETag or entity tag is one of the caching mechanisms. The way it works is akin to putting a unique identifier for the content on a given URL. In other words, if content doesn’t change on a specific URL, the etag will remain the same and the browser will use the cache.

In Figure 4, you can see an example of the ETag response header.

Figure 4: ETag header is enabled

Figure 4: ETag header is enabled

If someone doesn’t know what it is or how to use it, it’s better to leave the Express.js etag setting alone, which means that by default the ETag will be enabled. Otherwise, to disable it:

// ... Express.js app instantiation 
// ... Express.js app routes

This will eliminate ETag response header as shown in Figure 5.

Figure 5: ETag header is enabled

Figure 5: ETag header is enabled

By default, Express.js uses “weak” ETag. Other possible values are:

  • true: weak ETag, e.g., app.enable('etag'); that produces a response with ETag as shown in Figure 4
  • false: no ETag at all (IMHO not recommended), e.g., app.disable('etag'); that produces a response without ETag as shown in Figure 5
  • weak: weak ETag, e.g., app.set('etag', 'weak');
  • strong: strong ETag, e.g., app.set('etag', 'strong');

An identical strong ETag guarantees the response is byte-for-byte the same, while an identical weak ETag indicates that the response is semantically the same.

query parser

Query, or query string, is a data sent in the URL after the question mark sing, e.g., Express.js automatically includes the parsing of such query strings in the form of a middleware.

The default value for query parser is extended which will use the qs module.

All possible values for the query parser setting are:

The usage example with disabled query parser middleware as follows:

// ... Express.js app instantiation 
app.set('query parser', false);
// ... Express.js app routes

The usage example with qs query parser middleware, as follows:

// ... Express.js app instantiation 
app.set('query parser', `extended`);
// ... Express.js app routes

It’s possible to pass your own function as an argument. In this case, your custom function will be used for parsing instead of parsing libraries like qs. For example,

// ... Express.js app instantiation 
app.set('query parser', function(value, options){
  // ... value is a query string, process it here
// ... Express.js app routes


As usual with undocumented features, use them with caution. Also be aware of the framework’s versions (this article was tested with 4.8.1).

This text is part of Azat’s upcoming book—Pro Express.js by Apress. If you liked this article, make sure to opt-in for the newsletter.

The Foundation: Starting from Nothing

The Foundation: Starting from Nothing

Last year, at about this same time, I discovered The Foundation podcast. I was vacationing in Mexico and stumbled on it via Pat Flynn’s Smart Passive Income—a hyper-popular online infopreneur. I downloaded and listened to many similar podcasts on online business, but The Foundation surprised me in the magnitude of its guests’ success stories. These weren’t the product of a few niche blogs, life coaching and ebooks, but six figures per month (and up) marketing and SaaS companies.

Continue reading

Time to Up Your Node.js Skills

Node Program: Intensive Node.js, MongoDB and Express.js Course in The Bay Area

Are you a software engineer who wants to master an effective and fun-to-use, new platform Node.js? Is your goal to stay on top of the curve with cutting-edge technology, and to stay ahead of the competitive software engineering industry by delivering high quality products faster?

But that’s a real challenge. New technologies are poorly documented, and the best practices are often unknown. There’s a serious risk to waste valuable time pursuing the wrong stack or pattern when you read amateurish blog posts and outdated books.

The good news is that there are companies that have run Node.js in high-scale production environments for years (Storify-where I worked before it was acquired—is one of them). That’s the expertise you can tap into.

Most likely it’s not your fault that your company or team didn’t want to invest in Node.js stack a few years ago. The circle of adopters was small, because most of the early technologies are controversial and unstable. This is not the case with Node.js anymore! eBay, PayPal, Groupon, Walmart, DocuSign, and many other large corporations have all adopted Node.js. So this is a great time to jump on the stack before it becomes mainstream!

Not all languages and platforms are created equal. Time proves again and again that engineers who cling to old technology become hard to employ. Every programmers’ and businesses’ enemy is not staying up-to-date on technology. And nowadays with the increasing information overload, it becomes more and more challenging. That’s why we started Node Program, a two-day intensive hands-on Node.js, MongoDB and Express.js training, so you can keep growing in the most efficient way!

This training was conceived in 2012;, constantly taught, and improved since then. Overall, almost a hundred people went through it in organizations like: Cisco, Twitter University (Marakana), General Assembly, pariSOMA, and others. Every student got out of this program more than he/she expected (testimonials). And at the end of this course, I promise you that you will walk away with a few Node.js applications, developed by you.

In addition to the extensive core curriculum (full description)—which was battle tested in the Best Selling books in the Client Server category— you will be exposed to some tips from the trenches. Here are just some of the tipsguidelines and inclusions:

  • Why not committing Node.js modules to your repository is dangerous
  • Why Jade is hard to learn but is one of the most efficient and powerful template engines to master
  • How to escape the madness of levels upon levels of nested callback code
  • Why using the default maxSockets value is a bad idea
  • The best debugging tools that the Node.js professionals use
  • What are the hottest new frameworks that might replace Express.js as the de-facto choice
  • Why the Node Package Manager code was written without semicolons

We’ve put together the best information in the simplest way to help you learn about Node.js, Express.js and MongoDB. The only way to get the information like that is to spend years actively working with the Node.js stack, going to conferences, and constantly researching… or to attend the two-day Node Program class. Why take the long route of learning? Do you really have the time to study via trials&errors, source code, books, blogs and free online documentation? Basically, we are helping you to take a shortcut, save time, avoid frustration, and costly mistakes by using the best practices available.

The next class will be held on September 27–28, 2014—next weekend! We have a limited number of seats, so act now.

You can register for our in-person two-day course in San Francisco on September 27–28 at

PS: Do you live in a different state? At the last class, we had a student who flew from Florida! But if flying is not an option, send us a note via the form at, and we might have a solution for you.

MongoUI: Real-Time MongoDB Admin Web Interface (a la phpMyAdmin in Node.js)

MongoUI: Real-Time MongoDB Admin Web Interface is Your Life Ring

MongoUI is a real-time web interface for Node.js and MongoDB written with DerbyJS—a real-time full-stack web framework. It’s a app that can be run locally and on the server. Similarly, you can view and manipulate data in a local or remote database. The MongoUI project is in beta so use caution, and please contribute your feedback.

MongoUI on NPM:

MongoUI on GitHub:

MongoUI description (this page):

MongoUI features include:

  • Switch databases and collections
  • Search by field value (string, number, ObjectId)
  • Save search / filter results as a bookmark (each URL has a query)
  • Edit any fields’ values in a real-time editor
  • Get raw JSON objects

Here’s a one-and-a-half-minute video that shows filtering, editing, and switching collections:

Direct link to the YouTube video:

Continue reading

You’re Wasting $10,000 to $130,000!

Yes, you’ve read it right! You can be wasting anywhere from $10,000 to $130,000 right now by not sharing your technical expertise with others. In other words, you can keep the money by writing about tech. All this is doable while keeping your full-time job. You think it’s impossible? That programmers like to pay nothing for resources? Think again, because hundreds of authors already did it, with outliers like Nathan Barry and Sacha Greif making six figures. The best part is that (after the info product is ready) it’s mostly passive income!

Continue reading

CoffeeScript: The Good Parts

CoffeeScript: The Good Parts at QConNY 2014

It’s not a secret that the topic of CoffeeScript is controversial to say the least. Many reputable JavaScript and Node.js developers just hate CoffeeScript, but there are lessons we can all learn from its good parts! However, many developers just won’t go back to plain JavaScript after building something relatively serious with CoffeeScript.

My own story is going from making fun to loving it after a year developing an enterprise product. As with the famous JavaScript: The Good Parts book, we’ll look at what’s good in CoffeeScript (and it’s quirks too).

The CoffeeScript: The Good Parts talk will share experiences from the trenches of using CoffeeScript in production. This talk was first presented at the QCon New York 2014 conference. You can watch it on their InfoQ page. Or you can watch the video recorded at DevBootCamp meetup in San Francisco, CA:

Direct link to Youtube is
Continue reading

Introduction to OAuth with Node.js and Online Subscription—RELEASED!

The much-needed Introduction to OAuth with Node.js mini-book is released!

Introduction to OAuth with Node.js

Introduction to OAuth with Node.js: Twitter API OAuth 1.0, OAuth 2.0, OAuth Echo, Everyauth and OAuth 2.0 Server Examples

Get your PDF, EPUB, MOBI copy here –>
or sign up for Node.js and JavaScript Mastery Online here.

The online bundle has five (5!) books. Here’s the list of available books. It’s a $50+ value for only $4.87/mo.

Node.js and JavaScript Mastery Online: Colored code examples—paste into your projects!

Node.js and JavaScript Mastery Online: Colored code examples—paste into your projects!

If you read all the books in less than a month—great! Just cancel the subscription. But most readers prefer to keep it just so they have a handy reference when they need it.

The Introduction to OAuth book includes:

  • OAuth 1.0
  • OAuth Echo
  • OAuth 2.0
  • OAuth 1.0 Sign in with Everyauth
  • OAuth 2.0 Server

A typical modern web applications has to communicate with other services. Even if it’s your own service or application. This is usually done via an open standard for authorization or OAuth. Therefore, the ability to use OAuth in your work is paramount!

There are standards, specifications and fancy diagrams, and it’s useful to read them as the first step. However, developers often need hands-on experience to acquire the full understanding and confidence.

Introduction to OAuth in Node.js is a concise practical book that will help you to get started with OAuth 1.0, 2.0, Echo and implement a Sign in with Node.js using Twitter API (and hopefully any other) authentication.

We’ll go through the three main authentication methods utilizing minimalistic oauth module to explain basics, then use extensive everyauth with an Express.js app.

Get your PDF, EPUB, MOBI copy here –>
or sign up for Node.js and JavaScript Mastery Online here.

Intro to OAuth with Node.js: OAuth 1.0 (One-Legged)

Introduction to OAuth with Node.js: Twitter API OAuth 1.0, OAuth 2.0, OAuth Echo, Everyauth and OAuth 2.0 Server Examples

This text is part of Introduction to OAuth with Node.js mini-book which is available at

Introduction to OAuth with Node.js

Introduction to OAuth with Node.js: Twitter API OAuth 1.0, OAuth 2.0, OAuth Echo, Everyauth and OAuth 2.0 Server Examples

Let’s start with good old OAuth 1.0. The way it usually works is as follows:

  1. For the first time, when we authorize a user to use our app, we need to perform extra work and obtain access token and secret (three-legged).
  2. You store these values for each user in your application.
  3. Then, on subsequent requests, things become much simpler. We construct auth headers and make HTTP requests (one-legged).

Continue reading

Node Program July 2014 Report and New Dates

The Node Program July 2014 was a blast! We covered a lot of material, solved workshop tasks, build and deployed apps.

This training was taught under different names (Rapid Prototyping with JS) and with different companies (Cisco, Marakana, General Assembly, pariSOMA). However, the intimacy of a small group and intense focus allowed us to achieve greater understanding.

Continue reading

30% off on Practical Node.js

30% off on Azat’s latest book Practical Node.js: Building Real-World Scalable Web Apps!!!

30% off code: PNJS30 (valid until 9/30/14 at 11:59 PM EDT)

Practical Node.js: Building Real-World Scalable Web Apps

Practical Node.js: Building Real-World Scalable Web Apps


Leave your review on page:

What other readers say on

“Without a doubt the best Node book available”
“Totally Recommended!”
“I finally feel like I’m on my way to writing production level software…”
“Straightforward including Mongoose, Heroku, and AWS…”
“Great kickstart to Node.js”
“Great book definitely recommended”


July 15, 2014

Azat’s latest book about Node.js is ready!

Practical Node.js was designed to be a one-stop source for going from hello-world examples to building apps in a professional manner. The libraries covered in Practical Node.js greatly enhance the quality of code and make developers more productive.

You can get it on Amazon, B&N and Apress directly. Also, Apress has the ebooks in all formats.

The book’s website is at And the examples’ code is freely available at

Why Node Program is Different

Node Program

Node Program is the  fastest and most engaging way  to get started with Node.js, MongoDB and Express.js. It’s an  intensive  weekend-long  live course  taught in the Bay Area by skilled experts who have run Node.js in production  for years!

Node Program is the ultimate way to get up and running with the foundations of Node.js, by learning the required foundational skills to use Node.js! Learn more about our approach and curriculum.

Continue reading

The Nastiest Little Secret

The nastiest little secret about software engineering job search, in any time and geolocation that I’ve seen: virtually everybody wants senior developers. So there’s very little chase to get into the industry. One theory this catch 22 happens is because senior software engineers are 10-20x more productive with only 10-30% more pay. Or at least that’s what most of the companies think. I’m not sure this is true 100% of the time. Therefore, if you are a junior developer—fake it till you make it. Most of us have been there. Become an expert in one field, and make a name for yourself. Then the companies will fight for you. Networking also helps. You need to be considered for the job before the job opening has been posted to the company’s website.

Node Program July 2014 Registration

The Node Program registration is open now (6/11/2014 9am) until 07/21/2014 11:30pm PT. The registration is limited only to 10 students! Register now.

This is the core Node Program curriculum:

  • Node.js
    • Building “Hello World” in Node.js
    • Node.js Core Modules
    • Node Package Manager
    • Deploying “Hello World” to PaaS
    • Deploying to Heroku
    • Message Board: Run-Time Memory Version
    • Test Case for Message Board
  • MongoDB
    • MongoDB shell (mongo)
    • MongoDB Native Driver (mongodb)
    • MongoDB on Heroku: MongoHQ
    • MongoDB BSON data types
    • Message Board: MongoDB Version
  • Express.js 4
    • Installation
    • Express.js 4 Generator
    • Configuration
    • Routers
    • Main Middleware
    • Jade Template Engine
    • Stylus CSS library
    • Mocha for TDD/BDD
Node Program is a customized learning experience. We want you to tell us what questions do you have to tailor our program to your needs. Also we’ve developed elective project paths:
  1. Full-stack: Working on an Angular.js app that uses MongoDB, Node.js and Express.js server
  2. Integration: Working on third-party integration (Twitter) using OAuth and Everyauth
  3. Deployment: Working on deploying Node.js apps to Amazon Web Services (AWS) with Nginx and Varnish Cache

More information at the EventBrite page.

Seven Things You Should Stop Doing with Node.js

Seven Things You Should Stop Doing with Node.js

Inspired by 5 Things You Should Stop Doing With jQuery by Burke Holland, I decided to open a discussion and highlight seven things you should immediately stop doing with Node.js:

  1. Stop using callbacks
  2. Stop using * for versions
  3. Stop using console.log for debugging
  4. Stop using GET and POST for everything
  5. Stop using semicolons
  6. Stop using comma-first style
  7. Stop limiting your connections with default maxSockets value

Continue reading

Node Program Announcement: Intensive Node.js, MongoDB and Express.js Course in The Bay Area

We’re glad to announce intensive Node.js, MongoDB and Express.js course in the Bay Area — Node Program.

Node Program (np): Intensive Node.js, MongoDB and Express.js Course in The Bay Area

Node Program (np): Intensive Node.js, MongoDB and Express.js Course in The Bay Area

The July 2014 course has only 10 seats (only 10 students!), and the registration will be open from 6/11/2014 9am PT to 07/21/2014 11:30pm PT.

If you would like to get updates about Node Program, sign up for our email list.


Node Program is the fastest and most engaging way to get started with Node.js, MongoDB and Express.js. It’s an intensive weekend-long live course taught in the Bay Area by skilled experts who have run Node.js in production for years! Node Program is the ultimate way to get up and running with the foundations of Node.js, by learning the required foundational skills to use Node.js!


  • Engaging: Live experience learning from instructors, mentors and peers
  • Customized: Uniquely tailored to your needs; treat us as your consultants and coaches!
  • Convenient: One weekend (16h), no need to take PTO or travel (Bay Area)
  • Limited: Only 10 seats in each course; students undergo application process to insure they get the maximum out of the program and plenty of individualized attention
  • Exclusive: The course will be repeated only 6 times
  • Tested: Instructors have years of practical experience with Node.js and materials have been carefully developed and tested for success
  • Practical: Students will walk out with multiple Node.js apps (projects)
  • Transferable: Node Program is non-refundable because we want 100% commitment from students; but in the case of unforeseen circumstances you can transfer registration to another person before the deadline.

For more information, go to the event page.

JavaScript and Node FUNdamentals is Finished

JavaScript and Node FUNdamentals: A Collection of Essential Basics

JavaScript and Node FUNdamentals: A Collection of Essential Basics is a short read to brush up and refresh JavaScript and Node.js topics including frameworks like CoffeeScript, Backbone.js and Express.js. The motto of the book is “If it’s not fun, it’s not JavaScript.

JavaScript and Node FUNdamentals: A Collection of Essential Basics

JavaScript and Node FUNdamentals: A Collection of Essential Basics

JavaScript and Node FUNdamentals has these chapters:

  1. JavaScript FUNdamentals: The Powerful and Misunderstood Language of The Web
  2. CoffeeScript FUNdamentals: The Better JavaScript
  3. Backbone.js FUNdamentals: The Cornerstone of JavaScript MV* Frameworks
  4. Node.js FUNdamentals: JavaScript on The Server
  5. Express.js FUNdamentals: The Most Popular Node.js Framework

The book is available on (Kindle) and LeanPub (MOBI, PDF, EPUB).

Continue reading

Intellect as an Impediment to Successful Marketing and Selling

Intellect as an Impediment to Successful Marketing and Selling

After watching The Foundation video it struck me that an intellect can be an impediment to successful marketing and selling. I’ve heard some variation of this before but the aforementioned video was an aha moment when it all came together.

Have you ever heard about the curse of knowledge? Or cognitive bias? Basically, if a person knows something he/she assumes that everybody else also know that. This leads to omissions, assumptions and messages that don’t reach target audience. And it’s not because the average audience is stupider in general, they’re just not so fluent in this particular narrow topic and your language (The Secret Language Of Millionaires in the video). I have to fight myself tooth and nail with this bias when I’m writing my programming books!

Sharing my musings on Twitter led me to Steve Jobs who no doubt was intelligent and very good at marketing:

I think smart people have to work extremely hard to “dumb” down their marketing messages. A good example is the original Apple iPod ad that used X number of songs instead of Y number of Megabytes.

Original Apple iPod

Original Apple iPod

Another revelation was that all this time many people that I know (startupers) and I were doing it all wrong. Almost always we start with products instead of starting with problems. In the best case, we pick out our own problems to solve (some do it successfully, like Evernote founders). But where are the guarantees that our problems are not just emotionally exaggerated and the market for them is big enough? Instead we should identify the pain points first and try to pre-sell. Yes, pre-selling (before building) can solve this dilemma. Let consumers vote with their wallets (actually debit/credit cards). What if we can’t sell our service or product without it being ready, or without all the fluff like a catchy domain name, fabulous design, beautiful logo and half-a-dozen social media profiles? Then, the problem is not too big for us to work on it anyway. Not all ideas should be executed and not all problems are worth solving. :-)

Last night, I did exactly that. I created a Gumroad page for Introduction to Express.js video course. It took me half an hour, and it already has sales! The conclusion is to go lean early or suffer later.

CoffeeScript FUNdamentals: The Better JavaScript

CoffeeScript FUNdamentals: The Better JavaScript

Disclaimer: This text is a part of the JavaScript and Node FUNdamentals: A Collection of Essential Basics ebook which is available now for free. However, upon the book’s completion it’ll be priced at $2.99. The book is 80% done as of this writing. The formats available: PDF, EPUB and Kindle. If you would like to participate in the writing process by providing your feedback and future topics, fill this short Future Topics and Feedback form.

Continue reading

Practical Node.js TOC

As the Apress team of technical reviewers and copy editors and I make progress on the Practical Node.js manuscript, the date of the publication approaches fast. Last time I checked it was June 2014.

Practical Node.js: Building Real-world Scalable Web Apps

Practical Node.js: Building Real-world Scalable Web Apps

Many people ask me: how is the process compared to self-publishing? Is it worth the hassle?

So far, I can say only good things about my editors and the process of traditional publishing itself. I’m impressed about so many things I’ve already learned about structuring and technical writing. I feel like it enormously improved my style. There is more on this in my new meta book&resource ProgWriter.

As a sneak peek, here’s the tentative Table of Contents for the Practical Node.js book:

  1. Setting up Node.js and Other Essentials
  2. Using Express.js to Create Node.js Web Apps
  3. TDD and BDD for Node.js with Mocha
  4. Template Engines: Jade and Handlebars
  5. Persistence with MongoDB and Mongoskin
  6. Using Sessions and OAuth to Authorize and Authenticate Users in Node.js Apps
  7. Boosting Your Node.js Data with the Mongoose ORM Library
  8. Building Node.js REST API Servers with Express.js and Hapi
  9. Real-time Apps with WebSockets, Socket.IO and DerbyJS
  10. Getting Node.js Apps Production Ready
  11. Deploying Node.js Apps
  12. Publishing Node.js Modules and Contributing to Open Source

The good thing is that people who want to get the book first don’t have to wait ’til the book is released. They can pre-order the book on Amazon, or even better get access to the alpha version at Apress!

The alpha version will be release chapter by chapter starting in the next few weeks!

Migrating Express.js 3.x to 4.x: Middleware, Route and Other Changes

Migrating Express.js 3.x to 4.x: Middleware, Route and Other Changes

Express.js 4 is the latest (as of May 2014) version of the most popular mature and robust Node.js framework for web apps, services and APIs. There are some breaking changes going from 3.x to 4.x, so here’s a brief migration guide:

Continue reading

Express.js 4, Node.js and MongoDB REST API Tutorial

Express.js 4, Node.js and MongoDB REST API Tutorial

Usually good things don’t stay the same, so our tutorial on building a JSON REST API server with Node.js and MongoDB using Mongoskin and Express.js, and testing it with Mocha and Superagent, has became a bit outdated with the new Express.js 4 version release. Here’s a brand new, revisited tutorial for Express.js 4, Node.js and MongoDB (Mongoskin) free-JSON RESTful API server.

The code for this new tutorial is available at (master branch). The old tutorial’s code for Express 3.x, is still working and in the express3 branch.

Express.js 4 and MongoDB REST API Tutorial consists of these parts:

  1. Node.js and MongoDB REST API Overview
  2. REST API Tests with Mocha and Superagent
  3. NPM-ing Node.js Server Dependencies
  4. Express.js 4.x Middleware Caveat
  5. Express.js and MongoDB (Mongoskin) Implementation
  6. Running The Express.js 4 App and Testing MongoDB Data with Mocha
  7. Conclusion and Further Express.js and Node.js Reading

Instead of TL;DR:

If you’re only interested in a working code from the repository and know what to do, here are brief instructions on how to download and run the REST API server:

$ git clone
$ npm install
$ node express.js

Start MongoDB with $ mongod. Then, in a new terminal window run the Mocha tests:

$ mocha express.test.js

Or, if you don’t have mocha installed globally:

$ ./node_modules/mocha/bin/mocha express.test.js

Node.js and MongoDB REST API Overview

This Node.js, Express.js and MongoDB (Mongoskin) tutorial will walk you through writing the test using the Mocha and Super Agent libraries. This is needed for a test-driven development building of a Node.js free JSON REST API server.

The server application itself will utilize Express.js 4.x framework and Mongoskin library for MongoDB. In this REST API server, we’ll perform create, read, update and delete (CRUD) operations and harness Express.js middleware concept with app.param() and app.use() methods.

First of all, make sure you have MongoDB installed. You can follow the steps on the official website.

We’ll be using the following versions of libraries:

  • express: ~4.1.1
  • body-parser: ~1.0.2
  • mongoskin: ~1.4.1
  • expect.js: ~0.3.1
  • mocha: ~1.18.2
  • superagent: ~0.17.0

If you try to attempt to use later or older versions the code might not work. :-(

Continue reading

CoffeeScript Quirks

CoffeeScript Quirks

CoffeeScript is a solution without the problem.

— Unknown ironic source.

CoffeeScript is awesome, until it’s totally confusing, and it’s illogical, which can lead to unexpected and subtle bugs. If you’re one of the CoffeeScript haters please skip this post; for others, I’ll share a few notes on the CS quirks that I’ve observed.

For example, let’s say we have a counter and need to assign a value of index subtracted by one to it:

numberOfRadios = index -1

But the line above is not the same as:

numberOfRadios = index - 1

Did you notice that there’s a space after the minus sign in the second example? It took me awhile to track down this type of bug. The reason for this behavior is that the first line will be converted by the compiler to the function invocation and that is probably not what you wanted.

Try the minus one snippet on It outputs the following JavaScript code:

var numberOfRadios;

numberOfRadios = index(-1);

numberOfRadios = index - 1;

Another pitfall, that leads to writing despondently inconsistent code (by us developers), is caused by the fact that parentheses are optional for function calls.

This example involves if conditions in which we want to compare the value of the expression model.get() or the operand typeof to some strings:

a() if @model.get 'groupType' is 'radioGroupTabs'
a() if typeof @model.get 'condition' is 'function'

CoffeeScript is treating the entire thing as an argument and the results are pathetic. Duh. ;-( Here is the native JavaScript code:

if (this.model.get('groupType' === 'radioGroupTabs')) {

if (typeof this.model.get('condition' === 'function')) {

Placing parens over the function still does us no good. Look at this CoffeeScript code:

a() if @model.get ('groupType') is 'radioGroupTabs'

And its JavaScript output:

if (this.model.get('groupType' === 'radioGroupTabs')) {

The workaround involves using () around function calls, or flipping the order in the if statement so that the function invocation is the last bit of code in the if statement:

a() if (typeof @model.get 'condition') is 'function'
a() if 'function' is typeof @model.get 'condition'
a() if (@model.get 'groupType') is 'radioGroupTabs'
a() if 'radioGroupTabs' is  @model.get ('groupType')

The code above compiles to what we wanted originally:

if ((typeof this.model.get('condition')) === 'function') {

if ('function' === typeof this.model.get('condition')) {

if ((this.model.get('groupType')) === 'radioGroupTabs') {

if ('radioGroupTabs' === this.model.get('groupType')) {

Is it all good now? Not really, because I personally think this approach leads to inconsistencies: parts of CoffeeScript code that must have parentheses, while in other places they are optional.

Try these if conditon snippets yourself on

The next note explains the most common beginner’s mistake in CoffeeScript; that is to use an a instead of an a() for function calls. However, super inside of a class, must be called without parentheses in order to pass the arguments to it.

Moving on to the single hash (#) comments which are just skipped over by CoffeeScript. Again, this can lead to unexpected consequences.

For example, a straightforward if statement has a few lines of code:

unless A 
  blah blah

But if we comment out all of the lines inside of if, the whole thing will fail miserably at the compilation step (at least thank you for that, CoffeeScript!):

unless A 
  # b()
  # blah blah

Just by adding an empty else we can mitigate the failure:

unless A 
  # b()
  # blah blah

c() # the code continues here

Try this snippet yourself on

Last but not least, there is another CoffeeScript pitfall related to jQuery events that don’t propagate when the event handler returns false. Of course, CoffeeScript philosophy makes every function an expression (the last statement is evaluated if there is no return statement present).

b = ()->
  false # usually this result is less obvious and buried deep down in code
$a = $ 'input'
$ ()->
  console.log 'this happens all right'

$a.parent().click ()->
  console.log('this never happened')

Of course, in real life the b() function is not so obvious and it’s buried somewhere deep within Backbone and Angular model methods. And the event isn’t propagating up the DOM tree (return false). Therefore, we’ve lost the second event handler without even realizing t. Buyers beware of this elusiveness! :-)

Try the event propagation bug yourself on

This is the end of my list. If you know of any additional CoffeeScript idiosyncrasies, please send them my way. :-)

Further CoffeeScript reading:

DocuSign for BlackBerry 10 in a Few Hours

DocuSign for BlackBerry 10

Last week DocuSign engineering had a second internal hackathon (a nice collage resulting from the first one) and I built DocuSign for BlackBerry 10 in just a few hours (well, sort of).

Some of you might be wondering what BlackBerry is. It’s a mobile operating system that is actually in the process of surpassing Windows and Kindle, based on market share, according to this reputable study. Oh, and by the way, BB also has many loyal aficionados thanks to their years of being a mobile solo-provider to enterprises.

Luckily, DocuSign already had an app for Android and, based on my research, which consisted of looking at this page for a minute, and talking with our mobile dev manager, I figured out that I could just port the DocuSign for Android app to the BlackBerry OS. Porting is just a fancy word for re-writing something in a new language, or for a new platform, without changing functionality very much. It typically involves re-compiling, changing APIs, updating code and re-packaging.

It’s worth noting that RIM (the company behind BlackBerry) provides many other options for building BlackBerry 10 apps including:

  • Adobe AIR
  • Native
  • HTML5

This is probably done to boost the number of available offerings within their marketplace (BlackBerry World) and jump-start their development ecosystem, which is lagging far behind those of iOS and Android.

I have worked with Java and J2EE before. In addition, I was an Adroid guy for a long time prior to getting my first Apple product (MacBook Air): I remember that my very first smartphone (running buggy Android 1.6) had constant “Force Close” errors. However, up until this hackathon, all of my forays into mobile dev land consisted only of using HTML5 with the Jo and Sencha Touch frameworks. Awesome challenge! Or so I thought.

The goal was to use Android code, re-package it, and install it in the simulator (with or without changes). I decided to go with Android Studio vs. Eclipse, and downloaded these tools (download page):

The complete tutorials are available at Runtime for Android apps.

After downloading, literally, a few gigabytes of SDKs and packages, I was stuck with our code-base in Android Studio due to some Java exceptions regarding Gradle, so I resorted to using command-line tools.

These are the commands from the BlackBerry toolchain that I ended up using:

  • apk2barVerifier: to verify apk (Android) files for compatibility for bar (BlackBerry)
  • apk2bar: to re-package apk to bar
  • blackberry-deploy: to upload and install the app on a BlackBerry

It’s worth noting that for distributing BlackBerry 10 apps to the BlackBerry world, apps must be signed with a special token (tutorial). Obviously, I skipped this step for the hackathon.

Lo and behold, everything worked on the BlackBerry with 0 code changes (except where DocuSign tries to charge via Google Play). The end results were quite pleasing. Thank you BlackBerry for making it easier for us developers. I guess, I can now say that I develop native apps (yeah, right). :-)

DocuSign for BlackBerry 10: Homescreen

DocuSign for BlackBerry 10: Homescreen

DocuSign for BlackBerry 10: Sign a Document

DocuSign for BlackBerry 10: Sign a Document

DocuSign for BlackBerry 10: Main Menu

DocuSign for BlackBerry 10: Main Menu

DocuSign for BlackBerry 10: Document View

DocuSign for BlackBerry 10: Document View

In addition, I also found this neat but scammy-looking service called APK Downloader that allows us to install Android apps from the Google Play market directly onto the latest BlackBerry 10 systems. Simply enter the name of the app as a Java package, e.g.,, (link). The real hack! I could have used it from the beginning and saved myself a few hours. Therefore, it’s vital to conduct proper up-front research prior to embarking on a project! ☺

Growth Hacking The New DocuSign Experience

The DocuSign Momentum 2014 conference was a huge success, attended by over 1,200 people and filled with many announcements of new developments. One was a culmination of many years of hard work for DocuSign product engineering — the re-imagined web application dubbed the New DocuSign Experience.

The web app is fast, beautiful and well thought-through. It was a pleasure to watch its live demo on a large screens and hear tons of positive comments from glad DocuSign customers.

Being a part of the growth hacking team and its team lead / ScrumMaster, I had the chance to work on a few important features:

  • Responsive and dynamic homepage: certain sections on the homepage change based on account types and states, e.g., show “Your plan is expiring in X days” for trial users, but “You have Y documents left before reaching your limit” for freemium ones.
  • Visual notifications: special messages conveniently spread across the app, which are triggered dynamically based on user account states (similar to the dynamic homepage).
  • Analytics: removing old page-view-based tools in favor of event-based ones (go Mixpanel!).
  • In-app upgrade: before, it was not a smooth experience and required multiple logins, redirects and was a plain PITA.
  • Landing page for Sign a Document: when users self-sign docs, the recipients (CCs) see a nice page that prompts them to sign up.

Continue reading

Getting Published as a Programmer: The Practical Node.js Story

Finishing The Practical Node.js Manuscript

TL;DR: This is the story about how I got my first publishing deal, what this book is about, and what problems I encountered along the way.

I spent last weekend sitting in an awesome new coffee shop in Oakland, typing up the last two chapters of my Practical Node.js manuscript. The book is scheduled for release by the UK-based technical publisher Apress in the late spring.

I started writing the manuscript in October 2013. I devoted my weekends and holidays to it (as so many entrepreneurs and writers do). The fact that I smartly had a few example apps and some drafts written — some of them for my blog, others for proposals to Pragmatic (declined!) — helped to speed things up. (Needless to say, in publishing rejection is a common thing and often an opportunity to get better.) However, the writing itself wasn’t the hardest part. Here’s the short story why.

Continue reading

What is Growth Hacking

The First Day of The New DocuSign Exerience

Growth hacking is such an interesting term. When I first heard of it, either at one of the meetings organized by 500 Startups or on the Jason Calacanis’s show, it made a lot of sense to me. Growth is vital for startups, and hacking is all about finding clever solutions (which are usually temporary but efficient).

When I became a growth hacking team lead at DocuSign, I started reading more about growth hacking. Soon I found out that there’s a ton of confusion on the Internet around the meaning of this phrase.

Some folks, especially ones who’s been doing new media and online marketing for a long time, think that it’s just a fancy trend for good old tools and techniques like:

  • A/B testing
  • Email marketing
  • Referral marketing
  • Social media marketing
  • Viral marketing
  • Content and SEO
  • Analytics

It’s true that these kinds of online marketing have been around for the last 5—15 years! What these adepts usually miss is the difference in how growth hacking approaches product by directly influencing and oftentimes even developing it!

Note: Being a programmer hacker is not required to be a growth hacker.

On the contrary, there is little to no input from marketers on product decisions in traditional marketing. For example, imagine, there are a car manufacturer and its marketing department. Most likely, the marketers will have little to no input into the car’s engineering and design.

Another example, a pure marketer might organize an email campaign, but because the funnel hasn’t been optimized, the conversion rate turns out to be dismal. On the other hand, a typical growth hacker will first test the funnel, and only after optimizing it, they launch full-blown campaigns reaping better conversion rates!

In software, and info products (and maybe in services?), the relative low cost of prototyping — vs. increasing cost of advertising and other traditional strategies — lead to the emergence of a hybrid: growth hacking. The distinct boundaries between marketing and product departments become blurred.

The best growth hacking will involve some sort of product engineering, user experience and design work, gathering and analyzing of metrics and events.

Usually there are only two tactics for growth hacking:

  • Push
  • Pull

Push tactics often involve finding temporary “loopholes” and getting a competitive advantage by using them. These are examples we often hear/read about: AirBnB posting on Craigslist, Dropbox using free space for referrals, etc.

That’s all good, but as in our example with an email campaign, if the product is not selling itself — that’s where the most ROI is for a growth hacker: pull tactics. They involve working on a funnel, and making product better to use / easier to know about expired CCs, etc. In the next post, I’ll show how my team and I growth hacked The New DocuSign Experience.

To sum it all up, there is a good quote from TNW post by GAGAN BIYANI:

Growth hackers focus on low-cost and innovative alternatives to traditional marketing, i.e., utilizing social media and viral marketing instead of buying advertising through more traditional media such as radio, newspaper, and television.

PS: I absolutely positively recommend this amazing free ebook The Definitive Guide to Growth Hacking by Neil Patel and Bronson Taylor.

Pre-Order Practical Node.js and Buy Alpha!

Practical Node.js: Building Real-World Scalable Web Apps [Apress, 2014]

Practical Node.js: Building Real-World Scalable Web Apps [Apress, 2014]

My brand new book Practical Node.js: Building Realtime Scalable Web Apps is available for pre-order on! The book is dubbed “if you have time to read only one Node.js book, this is the book you should read”, and its ebook is also available in alpha for purchase directly from Apress.

Express.js Guide Goes to Apress


I’m extremely exited about my second book contract with Apress and also about using the product that I’m working on (the DocuSign web app) to wet this publishing deal. Pro Express.js is going to be the ultimate Express.js resource “thank you” to all my readers who contributed with suggestions!

Rare opportunity! Final sale!

Goodbye Express.js Guide Sale: 4 Books For Only $19.99 (reg. $84.97)

How to Stay Healthy and Sane Working 12-hour Days As a Programmer

DocuSign Momentum '14

The DocuSign Momentum conference is just a few days away, and my team and I has been pulling long shift in order to deliver something absolutely amazing and to make sure that it’s in a great shape. So I wanted to share what exactly helps me stay healthy, sane, productive and happy working as a programmer 10–12 hours per day sustainably:

  • Get at least seven to eight hours of sleep
  • Skip breakfast: clears mind, reduces calories intake, and saves time
  • Check work email only a few time per day and check personal email/Facebook/LinkedIn/etc only once (in the evening) preferably inboxing zero both categories
  • Meditate and workout (12 minutes is enough)
  • Cancel all activities and avoid any additional obligations and projects
  • Wear uniform-like clothing
  • Drink lots of good coffee (e.g., bulletproof coffee)
  • Avoid fruits, sugars, sodas (even diet ones), grains, legumes and potatoes, i.e., paleo lifestyle/diet
  • Change workstations: resistance ball chair, stand-up desk, sofa, etc.
  • Consume vitamins: C, Omega–3, Multivitamins and D3
  • Take walks and stay positive!

PS: The Healthy Programmer book has been on my to-do list for a long time. Please let me know whether you read/liked it.

Express.js Guide Might Be Retired and Re-Published Traditionally

A major technical literature publisher approached me and offered to publish Express.js Guide: The Comprehensive Guide on Express.js. The new book proposal was accepted by the editors last week. This is exciting news! The new book might become my first traditionally published book (I have Practical Node.js in the works).

What it means for potential readers: the content will become better (professionally edited technically and grammatically a few more time in addition to the current edits).

However, the price is likely to go up to over costs of traditional publishing house. This is not up to me. Publisher will have all the rights. The one thing I’m sure about: there would not be a budget Kindle edition available directly or via for just $9.99.

So if you want to get a copy, or know a friend who might benefit from the Express.js/Node.js book, get it now, before the publishing contract is signed. ;-)


Express.js Guide is #1 Best Seller in Cliet-Server on Amazon Kindle Store

Express.js Guide is #1 Best Seller in Cliet-Server on Amazon Kindle Store

Succeeding with Agile, Brief Overview I

Succeeding with Agile

Couple months ago, I was promoted to a ScrumMaster role at DocuSign. In light of it, I decided to brush up on my agile development skills and theory by reading. My choice fell on the highly acclaimed Succeeding with Agile: Software Development Using Scrum by the guru of Agile Development and Scrum — Mike Cohn.

Succeeding with Agile

Succeeding with Agile

Here is a short overview of the first half of the book, or gist as programmers call it:

  • A ScrumMaster has more responsibility and authority over processes, but a limited authority over people; the role is akin to a fitness trainer (a yoga teacher analogy fits me better): enforcing the agile process.
  • Every sprint team needs to deliver shippable (and tested) code: features, bugs, etc.; if the task is too large — split it.
  • Developers should work with product managers/owners directly on requirements.
  • Different developers should work on all parts of the application / code base.
  • Agile is not for the developers who likes to work in privacy putting their headphone and not talking to people (Bummer). :-)
  • Team functions better with a mix of generalists and specialists; avoid all-specialists teams at all cost.
  • When possible use feature teams rather than component teams.
  • Keep teams small. Four to nine people is an optimal size due to the social loafing (having more people reduces average productivity) — this was one of the reason our DocuSign team was split into three smaller teams!
  • A non-coding architect and project manager are obsolete roles on a Scum team.
  • Don’t let team members multitask. Each additional task reduces productivity; however, after three and more tasks the reduction becomes smaller and smaller. Direct quote: “Individuals assigned to work on multiple projects inevitably get less done

To be continued…

What I really liked about the book so far is that it’s not just boring theory. Each point is supported by data, references to sources and personal three-decade-long (anecdotal) experience of the author (Mike Cohn). If you liked the bullet point above, get Kindle Succeeding with Agile on Amazon.

Programmers Are Assholes?

Right now, I’m lucky to work in a great team where everybody is a wonderful human being. However, during the years in software engineering, I’ve encountered a disproportionate number of assholes comparing to other fields or professions. Does coding affect someone’s personality negatively or it’s the other way around? Do computers attract certain asocial elements, so they can put on the headphones and not talk to people? Why there are more assholes in software engineering than in real estate or food&beverage?
Continue reading

Invest in Yourself

Of course, foreigners steal your job!

In the modern society, it’s not enough anymore just to graduate from a four-year college, and hope the skills and education acquired there will get you through the next 30–40 years of professional life. This is very prominent in software and technology fields, but applicable to many other industries as well.

In the age of the information workers, just to stay competitive on the market place, we constantly need to re-invent or jobs and ourselves. However, not everybody is happy about it. I often find people who don’t read professional books, magazines, blogs, and don’t learn outside of the job duties. Wake up people!

It’s so easy. MOOCs and online courses like Udemy and CreativeLive provide affordable interactive education. Free online ebooks are everywhere. Pick up a new language like Node.js or build something cool with React.

It’s no surprise that tomorrow, these people might be the first to be left on the outskirts of professional world . And when this happens, whom they’ll blame?

Blog Express.js Web Application Example

Blog Express.js App Admin Page

For the past few weeks, I’ve been writing a new book on Node.js. Hence the lack of new posts. This time, the book encompasses virtually all of the practical aspects of web development using Node.js: authentication, authorization, OAuth with third-party service providers, testing, libraries, frameworks, databases, ORMs and MVC-like patterns. In other words, if you have to read only one book on Node.js (which is not a good advice, but let’s assume), this will be the book that you have to read. :-)

The title and the alpha sign up are in secret for now (subscribe to get the news faster). The book is due in early spring 2014.

Here is one of the main examples that is featured in the book: the Blog application built with Express.js, MongoDB and Mongoskin. The application is subject to change, but if you’re an intermediate or advance Node.js programmer, go ahead and poke the source code, kick the tires of the server. It’s not a Ghost blogging platform, but blog-express can give valuable practical tips on how to implement:

  • Session-based authentication
  • Express.js middleware authorization
  • MVC-like pattern using lightweight MongoDB library called Mongoskin
  • REST API server
  • Express.js routes organization
  • Jade and server-side rendering
Blog Express.js App Home Page

Blog Express.js App Home Page


Get Your Programming Questions Answered

If you have questions about programming and web development, we’re accepting them. Don’t suffer in the unknown!

Depending on the volume of received questions, we’ll be answering some of them on our blog and a future podcast.

Example topics:

  • What programming language should I learn?
  • How to land a dream job in software engineering?
  • What libraries should I use?
  • What is NoSQL?
  • What is Node.js?

Send your questions via the form:

56% off on Four JavaScript and Node Books During Holidays!

Holiday JavaScript

Holiday JavaScript

Hurry up to purchase four books on JavaScript and Node.js as a gift or for yourself. The deal will last only ’til the end of December 2013. The total value is over $62, but you can get all four books for just $27.49!

The bundle includes titles:

  • Rapid Prototyping with JS: Agile JavaScript Development
  • Express.js Guide: The Comprehensive Book on Express.js
  • Oh My JS: The Best JavaScript Articles
  • JavaScript FUNdamentals: A Collection of Essential Basics

Become smarter next year with the Holiday JavaScript bundle: