Home

Awesome

MEAN Boilerplate

MEAN stack boilerplate with build procedures in place.

Goals

This MEAN stack boilerplate offers to be a starting point for new projects, with the following goals:

All these requirements were identified through experience on past projects, and now extracted into this boilerplate. Although this is not the first MEAN boilerplate out there, it tries to offer all things above combined together as its unique value.

Out of the Box configured features:

Prerequisites

Boilerplate expects that you have the necessary platforms and tools installed (Git, Node.js, MongoDB). It also expect some global npm modules to be present on the system, so if you don't have them already, install the following:

$ sudo npm install -g grunt-cli bower phantomjs

Getting Started

After picking up the boilerplate as a base for your new project, run the following to pull all dependencies:

$ npm install
$ bower install

Now that you have dependencies installed, you may run your first build and do the project test-run (Linux and Mac; Windows users see here):

$ grunt
$ ./dev

If everything went well, you should have boilerplate project up and running, i.e. Express app listening on port 3000 serving your Angular app.

Additionally, running in development mode is configured to automatically refresh (restart) Express app on any source code changes, while changes to the client-side code are automatically picked up on browser refresh, as server is serving client/src/ content directly (as it's symlinked).

Grunt Build Chains

Results of debug and release builds are compiled client-side assets that are put in build/dist/ directory, and also copied to server/public/ for Express app.

That allows the flexibility of CI and deployment automation, which may publish assets to CDN and use reverse proxy (or some other method) for serving those static files without actually hitting the Express app, with having Express app ready to serve those assets as well.

Additional Grunt Tasks

By default, dev build chain runs tests on every change. Client-side tests are run using PhantomJS headless browser, and server-side tests are exectued using MochaTest runner, both reporting to console.

Still, some people like to have a GUI browser opened to check the client-side tests results, or wish to run tests manually. For those, there are the following tasks defined:

Configuration

To do the basic configuration, check out and adjust the following files:

More technical details can be found in a separate document.

History

License

This library is licensed under the MIT License