What is The MEAN STACK ?

Jeremy M Williams
8 min readJan 18, 2017

--

The term MEAN stack refers to a collection of JavaScript based technologies used to develop web applications. MEAN is an acronym for MongoDB, ExpressJS, AngularJS and Node.js. From client to server to database, MEAN is full stack JavaScript.

The main reason for choosing the MEAN stack over others is because of the use of a common language for both client-side and server-side. Since, all these technologies are written in JavaScript, your web development process becomes neat. Node.js is a platform that brought JavaScript implementation on the server-side. With Angular.js, using JavaScript on the front-end, it becomes easier to reuse code from back-end to front-end.

#SHAMELESS PLUG: Checkout my developing youtube channel and subscribe: CREATIVE LOOT TV ,,, I’m talking about everything but mostly tech and corporate culture ;)

MEAN stack offers a modern approach to web development. It also makes use of the power of modern SPAs (single-page applications), which does not require entirely refreshing a web page for every server request like most traditional web applications do. Today there is a trend to develop multiple frameworks that correspond to a single programming language and form a full-stack solution. But, as of now, using MEAN stack is a very effective approach to web development.

It was only a few years ago that MongoDB, Express.js, AngularJS, and Node.js were raising eyebrows on their own. Now they’ve grown up and ganged up, and together they’re doing serious work, poaching no small number of developers from the vast LAMP camp. But how exactly does this newfangled MEAN thing stack up against LAMP? When is it better to choose the well-tested, mature LAMP over this upstart collection of JavaScript-centric technologies?

Most people are use to LAMP Stack, and to be honest — I love the LAMP stack too! But here are a few disadvantages with it:

  1. Not build from scratch for cloud solutions: Technologies like PHP were not build for the current requirements which cloud solutions have. Rasmus Lerdorf created PHP initially for build smaller kinds of websites. Later other developers build on this legacy. It is now a large software, which might not be optimized in all areas. (Although they are trying to solve these issues with new PHP versions and PHP frameworks like Lararvel.
  2. Not as scale-able as MEAN: Many proponents of MEAN (MongoDB, Express, Angular, Node) will argue that MongoDB is much faster than MySQL. And also that LAMP is not as scale-able, due to its architecture.
  3. Several experts needed: You might need an expert in MySQL, someone else who is strong in PHP and may be even someone for the front-end development in HMTL/CSS.

Now to be fair , the MEAN Stack has some disadvantages too:

  1. You need experts: The MEAN technology stack has a lot of “limits” and bugs, which you need to know, so as to not build into the wrong direction. Angular for example has a lot of limitations (even though some of those issues are solved in Angular 2). This is the case with MongoDB and the other technologies in the stack as well. This also brings as to the next big issue:
  2. Difficult to find experts: You will have a difficult time to find developers who are strong in these new technologies. We tried for example to find a strong Angular developer. This is really tough. So you would naturally rely on entry level programmers in these technologies and try to somehow make them learn these quickly. But usually this will not work out well. (Unless you will find a bunch of nerds who are exited by these technologies)
  3. Not tried and tested: You might not find a lot of answers to questions in regard to MEAN online. Some technologies are so new, that there is only a small online community discussing the issues which might come up during development.

The general rule for when and when not to use the MEAN Stack goes as follows:

  • If you are building a new cloud based solution for end-consumers, especially if it is a crowded niche, you should go for MEAN, so as to create a great user experience for your customers. As well as having a fast solution.
  • If you are building an enterprise solution for your customers, then rely on the LAMP stack.

MEAN STACK EXPLAINED BETTER

MongoDB is built for the cloud

If your Web app plans include making good on the pennies-per-CPU promise of the cloud, the MEAN stack offers a compelling database layer in MongoDB. This modern database comes equipped with automatic sharding and full cluster support, right out of the box. Plug in MongoDB and it spreads across your cluster of servers to offer failover support and automatic replication. Given the ease with which apps can be developed, tested, and hosted in the cloud, there’s little reason not to consider MongoDB for your next project.

Node.js simplifies the server layer

Navigating the various layers of the LAMP stack can be a difficult dance of many hats, one that has you shuffling through various config files with differing syntax. MEAN simplifies this through use of Node.js.

Want to change how your app routes requests? Sprinkle in some JavaScript and let Node.js do the rest. Want to change the logic used to answer queries? Use JavaScript there as well. If you want to rewrite URLs or construct an odd mapping, it’s also in JavaScript. The MEAN stack’s reliance on Node.js put this kind of pipework all in one place, all in one language, all in one pile of logic. You don’t need to reread the man pages for PHP, Apache, and whatever else you add to the stack. While the LAMP generation has different config files for everything, Node.js avoids that issue altogether. Having everything in one layer means less confusion and less chance of strange bugs created by weird interactions between multiple layers.

MEAN makes code isomorphic

The simplicity doesn’t stop with using JavaScript on the server. By going MEAN, you can enjoy that same JavaScript on the client, too, leaving behind the LAMP stack’s client/server schizophrenia. If you write code for Node and decide it’s better placed in AngularJS, you can move it over with ease, and it’s almost certain to run the same way. This flexibility makes programming MEAN-based apps significantly easier. Plus, if you’re staffing up a project, you don’t need to look for a PHP expert and a JavaScript expert, or a front-end and a back-end specialist. Instead, it’s all JavaScript across the stack.

JSON everywhere

AngularJS and MongoDB both speak JSON, as do Node.js and Express.js. The data flows neatly among all the layers without rewriting or reformatting. MySQL’s native format for answering queries is, well, all its own. Yes, PHP already has the code to import MySQL data and make it easy to process in PHP, but that doesn’t help the client layer. This may be a bit minor to seasoned LAMP veterans because there are so many well-tested libraries that convert the data easily, but it all seems a bit inefficient and confusing. MEAN uses the same JSON format for data everywhere, which makes it simpler and saves time reformatting as it passes through each layer. Plus, JSON’s ubiquity through the MEAN stack makes working with external APIs that much easier: GET, manipulate, present, POST, and store all with one format.

Node.js is superfast

Apache was great, but these days, Node.js is often flat-out faster. These days, especially among impatient mobile device users, shaving even milliseconds off your app’s performance is important and Node.js can do that, while offering a Turing-complete mechanism for reprogramming it.

Depth matters

PHP lovers like to cling to the great libraries of code that are built for dominant platforms like WordPress or Drupal. They have good reasons to be proud, but their advantages are evaporating as Node.js catches up.

The Node.js package manager, Npm, makes it even easier to share code, and the public repositories targeting Node.js are growing quickly. While the PHP crowd may lead at this moment in time, the future may favor Node.js. Plus, incumbents often prove to be brittle in the face of shifting trends. Each attempt to modernize an entrenched platform like Drupal with a new version means that many more developers may be letting their eyes wander toward the newer, more nimble platforms built around Node.js.

AngularJS is fresh

It’s not exactly fair to compare the “A” in “MEAN” with anything in the LAMP stack because LAMP doesn’t include an analog. If you want to do anything on the client side, you’re on your own. Sure, there are plenty of good PHP-based frameworks that work with MySQL, but each is a bit different and moving in its own direction. WordPress, Joomla, and Drupal, for example, offer differing strategies, and it’s hard to switch between them, let alone port code from one to the other. Anointing one client framework adds consistency and stability.

It also helps that AngularJS was built by folks with 20 years of experience building Web apps. They knew well enough to leave the design work to HTML and CSS. They also figured out how to add a bit of JavaScript to scan the HTML. The designers of AngularJS looked at what humans do well, then tailored the JavaScript to support the humans. The templating system and the logic layers are dramatically cleaner than what we’ve seen before, in part because the team figured out simpler ways to leverage the local power of JavaScript to guess what you are doing.

WHO’S USING THE MEAN STACK??

There are many well-known organizations using Node.js in production, including PayPal, LinkedIn, Netflix, and the New York Times. Some examples of application types which can benefit from using Node are REST APIs, Chat applications and Real-Time Tracking applications (Brokerage trading dashboards, real-time user statistics, etc.)

This new approach requires the use of backend applications which are very fast, scalable and easy to deploy & maintenance. All major companies have started to migrate their applications to Node.js and others are building applications from scratch using the MEAN stack technology. PayPal, Dow Jones and Uber have already placed a business Node.js solutions into production. Yahoo, HP and many others have planned their next generation products on this MEAN stack platform.

Contact me at jeremy@vyudu.com if you need a custom website or app for android or iOS.

I currently work for large brands like Jaguar / Land Rover (Range Rover), Luxottica, and many celebrities and fashion bloggers. I know php, laravel, swift (iOS development) React Native, React, Angular, Bootstrap, MEAN Stack, and many other popular coding languages. If there is anyone you want in your corner, its me because I am a designer and a coder, and I am very known, endorsed, and trusted on linkedin.

You can also skype me @ codetheworld !!!

--

--

Jeremy M Williams
Jeremy M Williams

Written by Jeremy M Williams

Empire Builder with a poetic mind. A “Luxury brand expert” with hard knocks life experience. A “Writer” who codes. A “Strategist” who designs.

Responses (2)