MEAN Stack – A Gettting Started Guide
Why MEAN Stack?
The major benefit of the MEAN stack web development is that it is extremely quick to prototype with. It has become a popular choice for creating dynamic websites.
It supports the MVC (Model View Controller) architecture. It has a simplified server layer and is relatively easy and flexible to understand and use. The components are open source and has a lot of community support.
MongoDB is the database engine. It is a schemaless NoSQL database system which saves data in binary JSON format. The lack of a schema allows for fluid object definitions that don’t require extensive code changes, and by removing the need for highly complex structured queries, the system can often operate more efficiently than a similar architecture build over a relational database like MySQL.
In addition, the NoSQL nature of MongoDB allows you to quickly change and alter the data layer without having to worry about migrations, which is a very valuable attribute when you’re trying to build a product without clear specifications.
The key attraction of Node.js is its Event Loop. To scale to large volumes of clients, all I/O intensive operations in Node.js are performed asynchronously, making it entirely a non-blocking and event-based structure allowing us in building highly scalable and concurrent applications rapidly.
The Web Framework
Express JS is a lightweight framework + routing engine which runs on top of Node JS. It provides a number of robust features for building single and multi page web application. Express.js serves as the controller layer, directing application flow and marshaling data for the UI. It is inspired by the popular Ruby framework, Sinatra.
Express provides us a variety of features like consistent routing to modules,sub routers, static file serving, view caching, middle-ware interface etc. With express, you can get the server up and running in no time. It also makes coding in Node JS a lot easier.
The Front End UI
It neatly organizes the front end code in a structured manner & is a complete solution for rapid and awesome front end development.
The figure shows how these components interact with each other. The Angular JS resides in the front end and performs request to the server layer comprising of Node JS & Express. The request will then be parsed over by Node & handed to the Express framework for performing logical operations & retrieving data from the database layer (MongoDB). Once the data is fetched and the required operations are done, Express will use Node to return the results which will be taken up by Angular JS & presented to the end user.
Now, here’s the cool thing about this combination.
A few things you might want to consider before you jump in
Even though Node.js has active plug-in development, the technology is not as mature as the existing ones like Apache. So you may need to write your own plug-ins to cover the areas where Node.js is missing functionality.
If you are planning to migrate your existing SQL database to Mongodb. Translating the data requires a lot of work to eliminate unnecessary object attributes. But, once it is done the database will be much faster for data retrieval.
It is not compulsory that you have to use all of these stack components and/or only these stack components together. MongoDB, Express, AngularJS, and Node.js works well together but others might work as well. Instead of MongoDB, some apps might only need Redis or perhaps instead of Angular, you may use Ember.js,Backbone.js, or just jQuery. So feel free to choose whichever combinations you seem comfortable with.
Finally, these technologies have a lot of community support behind them so finding answers to questions or hiring help is going to be easy.
In this blog we focussed on introduction on Mean stack .
In part 2 of this blog, I will be covering the steps to create a sample app using MEAN. Watch this space.