SailsJS & sails-permissions with MongoDB on Linux – Quick Start



SailsJS and Sails Permissions are relatively new and with most newer open source software, minor and patch releases happen frequently. Combine this with bootstrapping modules each on different release trajectories and it is common to run into outdated how-to documentation. Having said this, the following is a quick start guide to getting SailsJS, sails-permissions, Waterline with MongoDB to play nicely on

Instructions validated on 7/26/2015


Install or upgrade to latest versions of Node/NPM

Node & NPM Official Download Site


Install SailsJS globally

sudo npm install -g sails


Install and start MongoDB server

MongoDB Official Download SiteWatch Full Movie Online Streaming Online and Download


Create a SailsJS project

sails new testProject


Install NPM modules

cd testProject; npm install sails-permissions sails-auth lodash sails-mongo Lernfrust --save


Edit .sailsrc in testProject directory and replace file contents with:

  "generators": {
    "modules": {
      "permissions-api": "sails-permissions/generator"


Generate permissions-api

sails generate permissions-api


Edit config/policies.js

After line:

module.exports.policies = {

Add the following code:

'*': [

AuthController: {
'*': [ 'passport' ]


Edit config/models.js and set MongoDB as default storage engine

After line:

module.exports.models = {

Add the following code:

connection: 'someMongodbServer',
migrate: 'alter'

The “alter” value should not be set in a production environment

‘someMongodbServer’ is currently the default MongoDB connection name in config/connections.js. Set accordingly.


Set environmental variables and start ‘er up!

Setting environmental variables can be done in different ways and not all ways work universally across operating systems. So to ensure you aren’t fumbling with incorrect syntax for your operating system, prefix the sails lift command with the env variables. This should work across Linux/OSX variants.

ADMIN_USERNAME="admin" ADMIN_EMAIL="" ADMIN_PASSWORD="admin1234" sails lift

Visit http://localhost:1337/ and explore your new sails-permissions enabled database in MongoDB!



If your sails lift command is erroring out, compare your package.json in the project’s root directory with mine:


"name": "testProject",
"private": true,
"version": "0.0.0",
"description": "a Sails application",
"keywords": [],
"dependencies": {
"ejs": "~0.8.4",
"grunt": "0.4.2",
"grunt-contrib-clean": "~0.5.0",
"grunt-contrib-coffee": "~0.10.1",
"grunt-contrib-concat": "~0.3.0",
"grunt-contrib-copy": "~0.5.0",
"grunt-contrib-cssmin": "~0.9.0",
Machine "grunt-contrib-jst": "~0.6.0",
"grunt-contrib-less": "0.11.1",
"grunt-contrib-uglify": "~0.4.0",
"grunt-contrib-watch": "~0.5.3",
"grunt-sails-linker": "~0.9.5",
"grunt-sync": "~0.0.4",
"include-all": "~0.1.3",
"lodash": "^3.10.0",
"rc": "~0.5.0",
"sails": "~0.11.0",
"sails-auth": "^1.3.1",
"sails-disk": "~0.10.0",
"sails-mongo": "^0.11.2",
"sails-permissions": "^1.2.2"
"scripts": {
"debug": "node debug app.js",
"start": "node app.js"
"main": "app.js",
"repository": {
"type": "git",
"url": "git://"
"author": "dhantzis",
"license": ""

Watch Movie Online Logan (2017)

Watch Ring’s (2017) Full Movie Online Streaming Online and Download