Installing Web Server

This section will help you walk through the minimum step by step to run Kindie web server

After install Node.js and npm Package Manager at previous step, now you have to install some tools, dependencies to run the Kindie web server:

Step 1: Open Kindie project by Visual Studio Code:

Note: You can toogle terminal by hot keys Ctrl + `

Step 2: Install Sails.js using npm Package Manager:

npm -g install sails
Sails.js is a small framework build on top of Express and Node.js framework. You can refer full document about SailsJs here:

Step 3: Install others npm Package Manager:

npm install

Step 4: Run MongoDB server
To start MongoDB, run mongod.exe. For example, from the Command Prompt:

C:\Program Files\MongoDB\Server\3.6\bin\mongod.exe

This starts the main MongoDB database process. The waiting for connections message in the console output indicates that the mongod.exe process is running successfully.

You can refer full document about MongoDB here:

Step 5: Config database and settings web server
If you need to test on dev eviroment, modify the config here:

config > env > development.js

5.1 Modify the database configuration:

      // ssl: true,
      adapter: 'sails-mongo',
      host: '', // defaults to `localhost` if omitted 
      port: 27017, // defaults to 27017 if omitted 
      user: '', //optional
      password: '', //optional
      database: 'kindiedb' // or omit if not relevant

5.2 Modify socket config ( For realtime chatbox mobile application): replace socket config with your domain:

sockets: {

    *                                                                          *
    * Uncomment the `onlyAllowOrigins` whitelist below to configure which      *
    * "origins" are allowed to open socket connections to your Sails app.      *
    *                                                                          *
    * > Replace "" etc. with the URL(s) of your app.        *
    * > Be sure to use the right protocol!  ("http://" vs. "https://")         *
    *                                                                          *
    onlyAllowOrigins: [

5.3 Modify port: default port for development environment is 1337, you can change what you want

      port: 1337,
Note: For production, you have to config the same things but with this file: config > env > production.js

Step 6: Config email server to send email (config > email.js)

        service: "Mailgun", 
	auth: {
		user: "no-reply@yourdomain",
		//pass: "key-xxx"
		pass: "yourpassword"
	templateDir: "api/emailTemplates",
	from: "no-reply@yourdomain",
	testMode: false,
	ssl: true

By default we are using Mailgun service, you need to register an account via then input the username/password here. Mailgun supports us to send with 10,000 free emails and a 100 free validations every month.
Step 7: Run the app
If you need to run on dev mode, from terminal console Visual Studio Code, run:

        sails lift

will run sails project on port 1337 by default, the web server will use the config is located at env > development.js.

If you get the log message like this, congratulation, you installed successfully the Kindy Web server.

For run web server on production mode, please modify the config at config > env > production.js (if no file create new) then run:

forever start app.js --prod
Note: Before run on production, you can run test production by command sails lift --prod

Note: On production server, You can create .env file and define also all the configurations via .env file at root folder:


Have fun!

Leave a Reply