A generator is a software tool that helps us create a project with directory structure based on best practices and standards.
This also allows multiple developers to work together and understand what and how others are doing.
There are various generator software available in market for different kind of technologies.


Yeoman helps you to kickstart new projects, prescribing best practices and tools to help you stay productive.


generator-express is one of the popular generator that helps us to create our Node.js MVC project using Express on the fly.
Here are the steps:

Install Yeoman:

npm install -g yo

The -g switch will install yo in the global namespace instead of our project.

Install generator-express plugin:

npm install -g generator-express

Install bower as it is used to manage static dependencies like JavaScript:

npm install -g bower

Run the yo command to create your project:

yo express

Now follow the on-screen instructions. Choose the following settings for now:

  1. Would you like to create a new directory for your project? Yes
  2. Enter directory name node-project
  3. Select a version to install: MVC
  4. Select a view engine to use: EJS
  5. Select a css preprocessor to use (Sass Requires Ruby): None
  6. Select a database to use: None
  7. Select a build tool to use: Gulp

Your project directory should be created now and the structure looks like this:


Here are some important files/folders:


Contains project information and its dependencies


Contains information like database settings, root path of project, port of server etc.


Starts your server at a given port


This directory contains all the controller files that maps routes to functions.


This directory contains all the models that represents entities or tables in database


This directory contains all the front end files containing HTML.


This directory contains all the static resources like css, js, images etc.

Now execute following command to download project dependenceis:

npm install

The project is ready, let us now run our server from the command prompt/terminal. Execute the command:

node app.js

You can check your server on a web browser at following URL:


The default port for the server is 3000 defined in config/config.js file.