What is the MEAN Stack?
- MongoDB - document database
- Express(.js) - Node.js web framework
How does the MEAN stack work?
Angular.js Front End
Express.js and Node.js Server Tier
The next level down is Express.js, running on a Node.js server. Express.js calls itself a “fast, unopinionated, minimalist web framework for Node.js,” and that is indeed exactly what it is.
Express.js has powerful models for URL routing (matching an incoming URL with a server function), and handling HTTP requests and responses. By making XML HTTP Requests (XHRs) or GETs or POSTs from your Angular.js front-end, you can connect to Express.js functions that power your application.
Those functions in turn use MongoDB’s Node.js drivers, either via callbacks for using Promises, to access and update data in your MongoDB database.
MongoDB Database Tier
If your application stores any data (user profiles, content, comments, uploads, events, etc.), then you’re going to want a database that’s just as easy to work with as Angular, Express, and Node.
That’s where MongoDB comes in: JSON documents created in your Angular.js front end can be sent to the Express.js server, where they can be processed and (assuming they’re valid) stored directly in MongoDB for later retrieval.
Again, if you’re building in the cloud, you’ll want to look at MongoDB Atlas. If you’re looking to set up your own MEAN stack, read on!
Is MEAN a full-stack solution?
Yes, MEAN follows the traditional 3-tier stack pattern, including the display tier (Angular.js), application tier (Express.js and Node.js), and database tier (MongoDB).
Why choose the MEAN stack?
Whether you’re building a high-throughput API, a simple web application, or a microservice, MEAN is the ideal stack for building Node.js applications.
MEAN Stack Use Cases
While MEAN is particularly suited to real-time applications, particularly those running natively in the cloud, and single-page (dynamic) web applications built in Angular.js, it can be used many ways.
- Workflow management tools
- News aggregation sites
- Todo and Calendar applications
- Interactive forums
And much much more.