1. Knowledge Base
  2. MongoDB Tutorials
  3. What is MEAN Stack: MongoDB, Express, AngularJS & Node.js

What is MEAN Stack: MongoDB, Express, AngularJS & Node.js

The MEAN Stack: An Introduction

MEAN Stack: MongoDB, Express, AngularJS, Node.js
The MEAN stack – also known as MEAN.js – is the collection of open source, JavaScript-based technologies that has changed the way developers build web and mobile applications.

MEAN is an acronym, which stands for:

  • MongoDB
  • Express
  • AngularJS
  • Node.js

The term was first coined by MongoDB developer Valeri Karpov in this 2013 blog post, where he outlines the advantages of using a single language throughout a technology stack.

This single language programming differentiates MEAN over the then-popular LAMP stack. Short for Linux, Apache, MySQL and PHP, LAMP required developers to know various languages like C, C++, Perl, Python, PHP and SQL.

When it comes to the MEAN stack, JavaScript is king, the most commonly used language among developers according to the 2018 StackOverflow Developer Survey, with JSON as its common dialect.

Let’s take a look at each component below.

MongoDB: The Database

MongoDB - Part of the MEAN stack

MongoDB is the NoSQL database that stores documents in a JSON-like format.

It also requires no upfront schema, so developers can then jump directly to the development process instead of the data organization process (which, of course, should still be taken care of).

Express: The Backend Framework

 

ExpressJS logo

 

Express.js calls itself the “fast, unopinionated, minimalist web framework” for Node.js. It’s lightweight yet robust, which has made it a go-to among developers and the backbone of many applications today.

But Node.js alone isn’t enough to build a website. Sure, it’s responsible for giving JavaScript backend functionality, but it is Express.js that provides Node.js the structure and extra functions for more seamless development.

Together, Express and Node extend the capabilities of JavaScript for backend development, making it possible for developers to build entire applications just with JavaScript.

AngularJS: The Frontend Framework

AngularJS - Part of the MEAN stack

“AngularJS is what HTML would have been, had it been designed for applications”.

The frontend component of the MEAN stack, AngularJS lets developers use HTML but it extends HTML syntax by creating new constructs, which spare the developer all the extra coding.

AngularJS modifies the HTML code it first reads from a page through a data binding and dependency injection method. It extends HTML attributes through directives, and binds data to HTML with expressions.

A directive is a marker that tells AngularJS’s HTML compiler to modify a DOM element (e.g. CSS class). ngBind, ngModel, and ngClass are examples of directives.

An expression, on the other hand, is a JavaScript-like code snippet that binds application data to HTML. Written inside double curly braces, expressions are mainly placed in interpolation bindings and directive attributes.

Node.js:  The Runtime Environment

Node.js logo

Node.js is a JavaScript runtime environment built on Google Chrome’s JavaScript Engine (V8 Engine). To understand why Node.js is so popular, we need to first look at latency and throughput.

Latency is the delay in data transmission or processing. Throughput is the amount of data processed. The sweet spot is to keep latency low and throughput high, which Node.js achieves through its “non-blocking” approach.

Unlike PHP which only executes commands after previous commands finish, Node.js executes commands concurrently, which makes it more time- and memory-efficient.

Advantages of the MEAN stack

Speed, simplicity, and scalability

MEAN’s individual technologies were all built to address speed, flexibility, and usability. The result is a modern and effective technology stack, which has enabled developers to create fast, easy, and highly scalable applications.

The npm registry, the package manager for Node.js, perfectly illustrates these perks. With over 350,000 packages or existing solutions publicly available, developers can easily tap into this resource to make coding faster and easier.

Single language programming = Developer productivity

The MEAN stack enables developers to code in a single programming language – JavaScript – throughout the whole development process.

Teams can then better collaborate because everyone speaks the same language, from backend to frontend.

Individual developers can also more seamlessly explore or transition other facets of the development process, without the extra hassle of having to learn another language.

Cost-effectiveness

Not only is the MEAN stack free and open-source – it also offers reduced development costs made possible by single-language programming.

MEAN.js enables developers to contribute throughout the whole development cycle instead of hiring separate help, not to mention that developers are also able to share and reuse code extensively.

Disadvantages of the MEAN stack

It’s always worth investigating – and maybe even implementing – the “Next-Big-Things” and “It” technologies like the MEAN stack. But that never means it’s right for your project.

Richard Clayton illustrates the importance of reflecting on one’ chosen technology or stack in the appropriately-titled, “MEAN’s great, but then you grow up“. Needs and teams evolve over time, and developers must always keep their finger on tech’s ever-changing pulse.

The rise of alternatives to the MEAN stack like MERN, which uses React.js instead of Angular.js, and MEVN which uses VueJS, shows that development teams can tweak existing framework options to suit their needs.

Companies & applications that use the MEAN stack

Here are a few examples of companies that use the MEAN stack to get the job done.

Airpair

Airpair website

Helping teams build faster and keeping them “un-stuck” is Airpair’s mission. It’s a service that pairs development teams with experts, in the hopes that it would “stop people from giving up because of technology”.

Airpair CEO and Founder Jonathon Kresner rebuilt AirPair.com from scratch in three months and chose the MEAN stack to do so.

“Full-stack JavaScript with NodeJS and ExpressJS meant I didn’t need to learn a new language and could become doubly proficient in one”, says Jonathon.

HelloFresh

HelloFresh website

The leading global provider of fresh food at home is powered by the MEAN stack, among other technologies, enabling them to deliver meal kits to households in more than 11 markets.

Trustroots

Trustroots website

Trustroots is a travelers’ community for sharing, hosting, and getting people together, with over 30,000 members.

Pushnami

Pushnami website

MEAN.js has helped the leading AI-powered cross-channel messaging platform to send more than 10 billion push notifications (and they’re currently hiring full stack developers).

Updated on November 22, 2018

Was this article helpful?

Related Articles