Scaffolding for an Express API using PostgreSQL with knex and bookshelf.

Usage no npm install needed!

<script type="module">
  import generatorOpinionatedExpressMvc from '';


opinionated-express-mvc NPM version

Scaffolding for building an Express API


Sets up an Express API configured for use with Postgres database through bookshelf and knex. Includes two resources with restful route configuraiton and associations.

This generator assumes user has postgres installed and running on your machine.


Global Install

To install globally, simply run:

npm install -g yo
npm install -g generator-opinionated-express-mvc

Local Install

If you don't have permissions to install packages globally follow the following steps

$ mkdir <your-app-name>
$ cd <your-app-name>
$ yarn init -y
$ yarn add yo
$ yarn add


To generate your new project run:

$ yo opinionated-express-mvc
$ yarn yo opinionated-express-mvc

note: this generator creates a directory for your project. If you've run the local install option, your project will be nested in a new directory. To fix this issue, mv the entire directory up one level by running $ mv <your-app-name>/* ./ && mv <your-app-name>/.* ./

Once the install/setup is complete, you'll be able to run the server and view the available resources at http://localhost:3001. Once satisfied, run the cleanup script.

$ yarn cleanup

This command will leave the directory structure intact, while removing the existing models, migrations, seeds, routes, etc.


  • Add test configuration with Mocha and Chai
  • Add additional logic (and prompts) for using alternative relational databases technologies
  • Scaffolding commands
  • Potential support for adding a React view layer


  • fork/clone
  • make changes
  • submit a PR


MIT © shane barringer