Use pagen.js to Create + Deploy node.js applications on heroku

A couple of weeks ago I created pagen.js to make setting up a website with node.js faster. In this post, I will explain how you can use pagen.js to quickly deploy to heroku. the first thing you have to do is generate one of the pagen.js templates.

note: You must have the heroku toolbelt and node/npm install to continue with this tutorial

Pagen.js gives you quite a few options when generating a website; however, all of the websites use the Express.js web framework. You can generate a Mongodb-based blog, a twitter bootstrap website, or just the default static Express.js website. In this tutorial, I will be deploying the default website.

First Steps

$ npm install pagen -g

$ pagen blue --heroku my_directory

The first line of code will install pagen.js in the directory were ‘node_modules’ is located in. The next will actually generate the code in your desired directory (my_directory). The ‘–heroku’ argument is what creates the shell script to initialize heroku and git in your directory. I picked blue since that’s my favorite of the default colors; however, you can pick whatever color scheme you want– see for more information on color selection.

At this point, all you really have to do is initialize the heroku app and commit/push to github.

Final Steps

$ heroku create

$ git commit -m "first commit'

$ git push heroku master


There, with only a few command, you have your node.js server running on a heroku stack. To learn more about pagen.js and my other projects, you can view my github.