Journey of building a SaaS product – Introduction
Introduction
Being a software developer throughout my career, I have build many stuff from hobby project, hackathon project, in-house mapping tool, mapping api, workflow webapp and many more.
Not all were successful though. Abandon project happens. Business direction change and we try to move on.
To keep the story short. I am currently starting a new project, which will be some sort of a SaaS nature kind of Web-App and probably be working on Mobile-App as well.
This will be a blog series where I will dedicate at least once a week to update on the status, technology, technical in-depth explanation, best practices, code and many more.
The Project
SaaS basically stands for Software as a service. Which mean, the software will be manage and hosted by the us. Only giving the end user an URL or Apps to use the software by charging on month or yearly subscription fees.
I will be working on 2 projects of this nature, which the domain will be keeping it P & C for the time being. On the other hand, I will be sharing some of the technical implementation and framework we used to build the system.
The Framework
For over the past 2 years, me and another friend of mine has been working on our framework to build business application. It was mean to be an on-premise ERP like web-application. Sadly, this project has been put on hold due to the longer than expected development time spend.
The core technology we’re using is base of NodeJS. Which we then mix and match many of the library found in the npm ecosystem, which I’ll slowly go in-depth those key library along this series.
ORM
To kick-off this series, I’ll be sharing a little on the database library we are using. If your’re somewhat have used NodeJS that need a good and reliable ORM. Sequelize is always in the list.
Why pick Sequelize? Before we actually jump on using this, we have also tried and research other, such as Waterline. For a start, in the beginning of most project development, we couldn’t decide on which database to be fix in (MSSQL, POSTGRES, MYSQL). And this library offer all of that sharing the same API usage.
On top of that, it can also run SQLITE on it. SQLITE is an important factor, as we have enjoyed the convenient of setting up development workspace without the need to install a lot of additional software. Just install Node will do. SQLITE convenient in many way. We created test using SQLITE and delete it once done testing. Easily restart a clean database by just deleting the SQLITE file. And this speed up tremendously during the development.
Another things that I like about Sequelize are hooks. Everywhere can be added a hook to intercept or change the content during the chain. Upon learning this, that we too begin to use this design pattern to implement our framework library that can be customize when dealing with different product using the same core engine.
const Book = sequelize.define('book', { title: DataTypes.STRING }); Book.addHook('afterCreate', 'notifyUsers', (book, options) => { // ... }); Book.removeHook('afterCreate', 'notifyUsers');
Besides that, is the plugin, specifically the GraphQL we are using. As of today(the day of writing), Sequelize has as much as 14,319 stars in the github. Meaning to say a lot of developer are using it and following it as well. Someone that I respect, Mickhensen contributed a lot here. As well as providing a lot of useful and well known technology as plugin for us to integrate.
There is also the much needed feature of scoping. When comes to multi-tenancy for a SaaS product, the last thing we want is to have a customer seeing other customer records due to silly programming mistake, as well as clean code. By having scoping set to the Sequelize level, regardless to writing code at the front-end or back-end, we can using do our usual CRUD action without the need of specifically handle the tenant columns.
That pretty much sums it all up of what I can think of this ORM can offer to us when choosing this library as the choice of our framework.
In the next chapter, will be covering a little on the technical design and implementation of Sequelize in our framework.