Skip to content
Daniel Durante edited this page Feb 10, 2014 · 2 revisions

CleverStack provides a fully featured NodeJS development workflow.

Some highlights:

  • NodeJS Application Core
  • Modularity NPM Coding Structure
  • Grunt Server with Live Restart
  • Databases supported: mySQL, Portgres or MongoDB
  • Modules for ORM and ODM (SQL & noSQL)
  • NodeJS Background Tasks Module
  • Unit & E2E Testing with Mocha

Application Structure

backend/
├── config/           # node app configs
├── lib/              # node app source files
├── modules/          # cleverstack app back-end modules
├── tests/            # app tests
├── Gruntfile.js      # app grunt tasks
├── app.js            # node express app
├── index.js          # node process management
└── package.json      # app npm dependencies

Important files and folders

config/

  • global.json: This allows you to define the Global (default) application settings for all environments.
  • local.json: This allows you to define the Applications config for the "local" environment. (presuming your NODE_ENV=local, or you have not set it.)
  • $NODE_ENV.json: This allows you to define whatever environment names make sense for your application, which will be merged with the global.json from the application's /config/ directory, the default.json (and/or global.json) from each module and $NODE_ENV.json from each module's config folder.

lib/

  • This folder contains the core of the Cleverstack Node Seed.
  • You can place global Classes, Controllers, Utils (etc) in the lib/$resource_name folder and it will be available via require('classes').$resource_name.

modules/

  • This is where all of the Cleverstack modules will be installed into your application.
  • You can also add custom modules inside this folder, or even NPM modules.

app.js

  • The main entry point of a clustered application.
  • If the background-tasks module is installed and enabled, this will setup the background task process.

Gruntfile.js

  • Defines the Applications global (main) gruntConfig.
  • Registers the Applications included Grunt tasks.

index.js

  • Use this script to spawn a single processed Application, useful for debugging with node-inspector. (Note: You will need to manually set your NODE_PATH for this script to work.)

package.json

  • Defines the Application and it's NPM dependencies.
  • Defines the modules that are enabled, using the bundledDependencies[] array. (This also let's NPM know that these dependencies are local and not on the NPM Registry)

Prev: Frontend (AngularJS) | Next: Modules