Let's start with understanding what is MVC

M - Model (Involves Databases, and rules)

V - View (It is the design and visual aspect)

C - Controller (It connects model and view via logic)

MVC is a software design pattern that helps us to structure the code into models, controllers, and views hence improving the code structure and readability.

Sails JS is an MVC framework for nodeJS, it is built on the top of node js and express Js so all that is applicable in NodeJS and express will work with sails JS.

[ Here is the installation guide to…

Today we will make a Books app

Libraries/Modules used:


Sails JS

Please make sure you have node js and sails js installed [Installation]

Initialise the sails project using

sails new books-app

Choose empty project in the console(2)

cd books-app

lets now quickly install all the dependencies

npm i mongodb mongoose

Go inside config/models.js uncomment migrate: ‘alter’ and replace alter with safe. Alter will drop the schema everytime we restart the server which we do not want.

migrate: ‘safe’,

Create a new file called mongoose.js inside config folder

touch config/mongoose.js

We will create our db connection using from this file…

sails js

Sails JS is a MVC framework for node JS built on top of Node and express JS. It provides allows you to quickly get started with the REST API’s.

Lets get step up a sails js project quickly to get you familiar with the framework.


Open up your favourite Terminal/command Prompt. I am using visual studio on ubuntu 20.04


Go to your preferred location, here I will choose Desktop/medium

cd Desktopmkdir mediumcd medium

Make sure you have npm and node globally installed, if not first install these two. Check node and npm version


Vinita Yadav

I write articles to share my experiences with technologies :)

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store