Understanding The MEAN Stack

Inspired by an article I recently read over at the HostPresto Community I’ve decided to give you an insight into MEAN. MEAN is a free and open source software stack or development platform written in Javascript as a means to produce dynamic web sites and web-based applications. MEAN consists of four main components which allow web developers to easily produce dynamic, modern and high quality websites without the need to start from scratch with the library providing a basis for your development endeavour. The four components of the library are each used for different purposes and include MongoDB for database management in the NoSQL format, Express.js a web application framework, Angular JS a well known model view controller for implementing user interface and Node.js which provides server side connectivity. The relatively new platform launched on February 12, 2014 and since becoming stable is being used by hundreds of developers with growing popularity.

MEAN has numerous benefits over other similar tools or not using any framework at all. The architecture is based on a single language throughout, Javascript meaning the learning curve for web developers isn’t steep and there is consistency throughout the platform. MEAN also supports the model-view-controller system or MVC which is a common tool when developing web applications and it utilises JSON for handling data requests which almost any developer should be well-versed in and provides the platform with wide ranging scope. Finally, MEAN includes the huge Node.js library containing thousands of useful modules improving development design and efficiency all in this open source package giving experienced users extensive room for tweaking to suit their individual circumstances.

MongoDB is the database component behind the stack. It utilises a NoSQL philosophy instead storing data in a document orientated manner by utilising JSON like documents with dynamic schemas. The system is utilised by large technology companies such as Craigslist, eBay and Foursquare as backend software and is extremely scalable. This method of implementation also allows the database system to the flexible and extremely powerful supporting features such as dynamic queries, secondary indexes, dynamic updates and aggregation. Therefore, MongoDB is an excellent choice for database management due to its power, flexibility and ease of use all integrated within the MEAN system.

Express.js is a lightweight framework providing support for web applications in the MEAN stack. It provides numerous robust features for creating both single and multi-paged web applications and is inspired by the popular Ruby framework, Sinatra. This means that the core features are relatively minimal with extensive ability for tweaking through plugins. By providing an extensive base for web application development, Express.js will save you time and money throughout the development process combined with its ease of deployment and use.

AngularJS is an MVC tool developed by Google which also lies at the core of the MEAN architecture. An MVC or model view controller allowing developers to easily address the challenges of developing single page web applications. AngularJS reads the HTML page which contains special AngularJS specific attributes before binding input and output to these attributes through standard Javascript variables or dynamic JSON resources. This allows web developers to easily produce single page web applications within the MEAN stack by providing a comprehensive mechanism to control output on the page dynamically. Angular is extremely popular used on thousands of websites including those of NBC, Sprint and Intel since it brings traditionally server side services to client side applications which in turn also reduces the overall server load.

The Node.js library is the final component of the MEAN stack which is a Javascript library that contains thousands of modules built on Google Chrome’s V8 Javascript runtime and it is also highly scalable. The platform assists when developing server side applications which then allows the applications to be run across almost all platforms available. When all four components are utilised together under MEAN, developers have an array of tools at their disposal to create amazing web applications that are highly scalable with everything required provided for by the MEAN architecture.

Getting started with MEAN is very simple, especially if your web server or development environment utilises a Linux environment. Just run the following commands from the terminal like you would install any other software.

  • $ sudo npm install -g mean-cli
  • $ mean init yourNewApp

Voila, you have downloaded, installed and created a new project in MEAN entitled “yourNewApp”. You can now utilise this new environment and all of the tools and functionality that come with it in your next major development or just play around.
Another option to get MEAN is to clone the Git repository if you are that way inclined. Simply use the following command.

  • $ git clone https://github.com/linnovate/mean.git

After installation navigate to the folder in which you installed MEAN and issue the grunt command. This command will start a server listening on port 3000. Navigating in the browser to http://localhost:3000 will direct you to your new MEAN stack server and you should be presented with simple page if all goes well.

You will now be able to use MEAN once it has successfully installed. All the components are installed automatically if following one of the two methods above and the environment is completely set up for development. MEAN is now used by thousands of developers and its popularity is growing exponentially. It provides a unique, comprehensive package for designers and developers to produce quality web applications that are cross-platform, scalable and very complex while also simple and small apps to be produced quickly and easily if need be. It is this diversity that makes the architecture so popular and it will only continue to grow. So if you aren’t using MEAN you should examine everything this package has to offer and see if it matches your needs as it may make your development experience more efficient and developer friendly than what you are currently using.

Posted in Web Hosting.

Leave a Reply

Your email address will not be published. Required fields are marked *