The MEAN Stack – An Introduction

Since my web stacks post was one of my better received posts, I decided today to write about one of the stacks I mentioned in that post; the MEAN stack. No the MEAN stack has nothing to do with being unkind nor with statistical averages. It is an acronym made of the first letters of the following four technologies used in the stack; MongoDB, Express.js, Angular.js, Node.js. This article is a quick primer for the non-technical folks on the MEAN stack.

In the web stack article, I talked about the layers in the web applications stack which were the operating system layer, the data persistence layer, the web server layer and the front-end layer. Before we start talking about the layers, we must first talk about one incredible programming language that is now one of my favorite languages; JavaScript.


Give the Wikipedia of entry for JavaScript a look as it is a great read. If you don’t feel like reading that, all you need to know is that JavaScript started out as a scripting language for manipulating HTML documents in web browsers (all web sites are made up of HTML documents). As the world wide web matured, JavaScript came to be utilized for more than just web browser scripting and it came to be used in server-side scripting, desktop software and even database management systems. The evolution of JavaScript into the juggernaut language that we see today would not have been possible by without the N in the MEAN stack which stands for Node.js.


Node.Js is an open-source run-time environment that allows programmer to write JavaScript code for more than just than web browser. Using Node.js developers can write server side programs outside of the browser. This means that by utilizing Node.js, developers are no longer limited to using JavaScript to manipulate HTML document but can now interact with any server side functionality such as networking, disk input and output operations such as a file system manipulation and any other server side functions provided by the operating system.

After the advent of Node.js, a package manager called node package manager (NPM for short) was written to distribute all open source packages written for Node.js to the rest of the developer community. With the power of NPM, any package written for Node.js could now be distributed widely to all users of Node.js. Once the developers got their hands on the open source tools and NPM, the rest was history. JavaScript exploded in popularity and the sheer volume of packages written for Node.js and distributed using NPM became staggering. You will not believe that the following package exists for Node and are distributed using NPM.

This is when the idea of using a single language (JavaScript) for the entire stack started to take hold. The idea being that if we can use JavaScipt to manipulate what we see in the browser and what is being done on the server side, why not use JavaScript for the entire application stack from lower level server side code, to the web server and any other middleware to the database. That is when the MEAN stack was born.

The M in MEAN: MongoDB

You know how certain brands become synonymous with a a product? Like how lots of people say “I need a Kleenex” instead of “I need a tissue”? Well, such is the story of MongoDB. Even though it is by no means the only document based database around, it was such a pioneer and is so popular that it is now synonymous with the N in the MEAN stack. Want to implement a full-stack using JavaScript? Great! What else will you use except MongoDB?

MongoDB is a document based database system and is classified as a NOSQL database which means it does not use the Sequential Query Language (SQL). It uses JavaScript notation to store information and uses a query syntax that is also based on JavaScript for retrieving information.

New entrants in the market (such as AWS fully managed DocumentDB) are catching up so watch out MongoDB. But the MEAD stack? Doesn’t have the same ring does it? Also, notice that even the headline on the AWS page for DocumentDB says “MongoDB compatible”. Now that is what I call dominance. On to the middle-ware/web server layer.

The E in MEAN: Express.js

For the next next letter in the stack we have Express.js. Express is a web application framework written for Node.js and is distributed using NPM. With Express, developers can write middle ware and application programming interfaces for their web applications. Express have become the standard for writing server side APIs and web servers in the MEAN stack.

With Express, developers can create routes and methods that can be utilized by the web application for serving static HTML content or dynamic server side content such as API responses. Also, the API responses are usually returned in JavaScript Object Notation (JSON). See? I wasn’t kidding when I said everything in this stack is based on JavaScript.

Now on to the Front-End layer

The A in MEAN: Angular.js

Angular is an open source-front-end web development framework. It is maintained by Google. Long story short, Angular allows developers to easily create single page applications and provides a framework for implementing the MVC (Model View Controller) and MVVM (Mode View and View-Model) design patterns. Don’t worry if all that is all Greek to you. Just know that Angular is written in JavaScript, maintained by Google and it is what makes the web pages “dance” in the MEAN stack.

The N in MEAN: Node.js

We have already spoken a little about Node above but in summary (if the above was Greek to you) is that Node is operating system independent and it is the core upon which the entire MEAN stack is built. if it hand’t been for Node, MEAN stack would not exist. Node can run on Windows servers, Linux servers and even desktop operating systems. I am sure there are implementations on mobile operating systems as well.

There you have it folks; the MEAN stack. One of the reasons I love the MEAN stack is that JavaScript is a beginner friendly language. Also, there are so many job possibilities out there for JavaScript developers that I say to all new developer that if you want to go into web development, learn JavaScript. Otherwise, learn Python first and then you can branch out after that. So go-ahead and learn JavaScript. You will be a lean MEAN coding machine. (By the way, JavaScript is to Java what is hamster is to ham. The two are very different). πŸ™‚

Until next time, happy coding.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s