It was clear from the beginning that we wanted to create a separation of concerns for the front-end by adopting a MVC architecture, and so it was natural to pick Express as the underlying framework.
An MVC framework allows us to:
- Split back-end and front-end code responsibilities. The front-end should be concerned with what data to display and how to display it, while the back-end is concerned with how to retrieve and store the data
- Have a front-end designer change the design of the front-end, without any knowledge of the back-end
- Create a backend that back-end that is fully independent of the front-end. Meaning that if we chose to create a client application or a separate set of web services or use the data in another way the back-end code is extractable from the rest to be ported over to a new application of any kind and used to store and retrieve data
Express allowed us to achieve this with minimal setup. Furthermore, its use is open ended enough to allow us to create a multi-tier backend exposed through what we’ve dubbed the service layer. Express’ routes call into these services, and these services are then responsible for communicating with the other back-end tiers. Wrapping our “back-end” code in this service layer ensures that all retrieval of data yields identical results whether that call is made from the current web application, API, or for future applications.
The tiers of our back-end code will be discussed in more details in a future blog post
Through our own research and testing we opted to use MongoDB as our database for HelpMonks. MongoDB comes with a document-oriented storage mechanism and is perfect for our purpose of storing emails. It is known as a NoSQL database, and allows us to store our data in a format that is essentially equivalent to JSON. And free-form JSON at that - there is no structure that our data must adhere to other than the structure we enforce through code. Thus MongoDB’s open nature gives us the option to embed documents within documents for the fastest recall of related data. We find in almost all cases more data is retrieved scanning less collections (MongoDB’s version of tables) than we ever were able to do using SQL databases.
Deploying a Node.js/MongoDB application is quite easy and becoming easier monthly as more and more providers are becoming available on the market. For both Node.js and MongoDB there are many Application hosting stack providers available.
Our initial test was run on OpenShift and Heroku. However, we quickly realised that running our own servers with Digitalocean is not only less expensive but gives us more flexibility (since we also wanted to run our blog on Ghost and our forums on Discourse). DigitalOcean refers to their virtual servers as droplets. We found it is convenient to get additional droplets(which are ready in under a minute). Plus each droplet has its own Snapshots and Backups.
Additionally, with the use of Nginx we can achieve a load balanced environment easily.
And as for MongoDB, we entrusted MongoHQ with our data. Their platform is simply stunning and the production plan comes with backup, scaling and wonderful log tools to see how our queries perform in production.
Keeping Communication Streamlined
Our promise with HelpMonks is to keep your communication streamlined. HelpMonks will be invisible to your employees, boost team productivity and feel personal to your customers.
We are currently hard at work developing HelpMonks. Sign up today at http://helpmonks.com. Be the first to take part in this innovative new way to interact with your customers.