Home Topics MEAN stack What is MEAN stack?
Build a MEAN stack with IBM Sign up for cloud updates
Illustration with collage of pictograms of computer monitor, server, clouds, dots
What is MEAN stack?

A relatively new stack, MEAN stands for MongoDB, Express.js, AngularJS and Node.js. MEAN is an end-to-end JavaScript stack largely used for cloud-ready applications. It is gaining popularity in modern web app development.

Understanding why you might use it, identifying examples of when to employ it and diving deeper into the individual components can help you maximize the value of MEAN for software development.

Strategic app modernization drives digital transformation

Strategic application modernization is one key to transformational success that can boost annual revenue and lower maintenance and running costs.

Related content

Register for the guide on DaaS

Benefits of MEAN stack

When building an application from scratch, employing a consistent, standardized software stack is vital. Creating your back end with a set of tools designed to work together reduces development time and streamlines resources.

However, the stack field is getting crowded. From LAMP to Ruby on Rails, there are a number of options. Each stack has its benefits and downsides and is geared for different projects. There’s no one-size-fits-all stack for development.

MEAN is an open source web stack that is mainly used to create cloud-hosted applications. MEAN stack applications are flexible, scalable and extensible, making them the perfect candidate for cloud hosting.

The stack includes its own web server so it can be deployed easily and the database can be scaled on demand to accommodate temporary usage spikes. A MEAN application enters the world optimized to take advantage of all the cost savings and performance improvements of the cloud.

JavaScript has long been a popular language for front-end web development—it’s flexible, dynamic and easy to use. But it has been an option only for back end and database development for a few years, allowing developers to create applications that use end-to-end JavaScript. Because every part of MEAN uses the same language, you can streamline your development teams.

MEAN removes the need to hire different specialists to develop each part of an application. Instead, you can use a single pool of JavaScript developers to work adaptively, where and when needed. Standardizing on JavaScript also provides an opportunity to reuse code across the entire application, reducing unnecessary reinvention. 

MEAN stack use cases

While the MEAN stack isn’t perfect for every application, there are many uses where it excels. It’s a strong choice for developing cloud-native applications because of its scalability and its ability to manage concurrent users. The AngularJS front end framework also makes it ideal for developing single-page applications (SPAs) that serve all information and functionality on a single page. Here are a few examples for using MEAN:

  • Calendars
  • Expense tracking
  • News aggregation sites
  • Mapping and location finding
MEAN stack components

MongoDB
MongoDB is an open source, NoSQL database designed for cloud applications. It uses object-oriented organization instead of a relational model.

In the MEAN stack, MongoDB stores the application’s data. Because both the application and the database use JavaScript, there’s no need to translate the object as it journeys from the application to the database and back. The application can push and pull objects between the back end and the database without missing a beat.

MongoDB is touted for its scalability in both storage and performance. You can add fields to the database without reloading the entire table and MongoDB is well known for its ability to manage large amounts of data without compromising on data access. With just a few clicks, you can expand the resources available to your database, making it perfect for applications with occasional periods of increased activity.

For a deeper dive into MongoDB, see "MongoDB: An Essential Guide."

Express
Express is a web application framework for Node.js. It balances ease of use and a full feature set.

Forming the back end of the MEAN stack, Express handles all the interactions between the front end and the database, enabling a smooth transfer of data to the user. It’s designed to be used with Node.js and to continue the consistent use of JavaScript throughout the stack.

Express is minimalist—it’s designed to efficiently handle processes without cluttering your application. But don’t confuse minimalist with featureless. Express offers excellent error handling and templating functions to aid your development.

Express can also protect you from yourself because it uses the CommonJS module standard to prevent inadvertent overwriting of variables within the shared namespace. You can’t accidentally redefine a variable that you previously created. This enforcement of JavaScript closures can help prevent a time-consuming and costly error.

AngularJS
AngularJS—Google’s JavaScript front end framework—isn’t the only front end framework in use, but it’s exceedingly popular. It is effectively the default for front end JavaScript development. If you’re developing a web application in JavaScript, you’re using AngularJS.

The MEAN stack includes AngularJS to help developers build the user-facing side of the application. Because the back end, front end and database are all built on JavaScript, there’s a smooth flow of information between all parts of your application.

AngularJS didn’t become the most popular JavaScript front end framework by mistake. Its ability to simultaneously develop for desktop and mobile use, its well-tuned performance and its easy-to-use templates make it the ideal front end to build cloud-native applications.

Node.js
Node.js is an open source JavaScript framework that uses asynchronous events to process multiple connections simultaneously. It is an ideal framework for a cloud-based application, as it can effortlessly scale requests on demand. You’re likely to find Node.js behind most well-known web presences.

Node.js is the backbone of the MEAN stack. Express is purpose-built to work on top of Node.js and AngularJS connects seamlessly to Node.js for fast data serving. Node.js comes complete with an integrated web server, making it easy to deploy your MongoDB database and application to the cloud.

The greatest strength of Node.js is its scalability. Cloud applications are best when they can respond quickly to usage spikes. What good is virtually unlimited processing power if it’s only available after your users time out?

By expanding your resources as they’re needed, you’re able to serve more users. Meanwhile, the framework’s single-thread architecture allows the application to effectively provide a smooth user experience across numerous connections. Node.js can support as many as a million simultaneous connections.

Remember, Node.js works best with many low-resource requests as opposed to resource-intensive requests. While a single thread protects against process deadlocks, it’s not immune to a large process freezing the system for all clients.

Related solutions
IBM for cloud native

IBM Cloud® is a leader in cloud-native app development and a trusted partner to build your enterprise apps quickly on an open, secure and integrated platform.

Explore IBM for cloud native
IBM Cloud Infrastructure

IBM Cloud Infrastructure as a Service is the infrastructure for smarter business. Find the right solutions for your business requirements.

Explore IBM Cloud Infrastructure
Take the next step

Designed for industry, security and the freedom to build and run anywhere, IBM Cloud is a full stack cloud platform with over 170 products and services covering data, containers, AI, IoT and blockchain. Use IBM Cloud to build scalable infrastructure at a lower cost, deploy new applications instantly and scale up workloads based on demand.

Explore IBM Cloud Start for free