LAMP vs MEAN vs Whatever

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 some really 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? These are few of the questions I am going to try to answer today.

LAMP stack

As we all know, LAMP stands for Linux, Apache, MySQL and PHP/Python. It has been popular for a long time, which means there are tons of tutorials and stack overflow posts that you can reference if you get stuck. Even the worst hosting services generally support it.It has time-tested tools like PHP Admin and powerful CMS tools like WordPress and Drupal. By combining a Web server (Apache), dynamic components (using Perl, Python or PHP), and a database (MySQL) you can create a truly database-driven and dynamic Web site that is easy to update and provides rich functionality to support users.

MEAN Stack

MEAN stands for MongoDB, ExpressJS, AngularJS, and Node.js. Here, Linux operating system is replaced with any operating system that Node.js can run on. This includes MS Windows, Mac OS, and Linux.
The Apache web server is replaced with the Node.js.
The MySQL is replaced with MongoDB, which is a No-SQL database that frees you from having to micromanage migrations and schemas.
The PHP server side programming language is replaced with the ExpressJS, which basically provides a thin layer of features over Node.js.
Note that ExpressJS and Node.js in combination are tools to run JavaScript on the server side.

Why MEAN took my heart away..

Below I have listed the primary reasons to choose MEAN over LAMP.

  • Javascript and only Javascript

    In the last decade, the JavaScript was, and still is, a mainstream scripting language that runs on the client side (browser) and makes web pages dynamic and responsive. The MEAN stack keep using the JavaScript on the client side by introducing the powerful client side Javascript framework (AngularJS) which makes it easier to build modern Single Page Apps. As you might notice, there is no programming language to be used with the MEAN stack other than the JavaScript. Using the same language on both ends make lives simpler for developers.

  • MongoDB is built for the cloud

    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.

  • MySQL’s structure is confining

    Like all relational databases, MySQL forces you to push your data into tables. This isn’t a problem if every single entry fits into exactly the same format, but what if two people share the same address but not the same account? What if you want to have three lines to the address instead of two? MongoDB, on the other hand, offers a document structure that is far more flexible.

  • Node.js simplifies the server layer

    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.

  • 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.

  • Node.js is superfast

    Apache was great, but these days, Node.js is often flat-out faster. A number of benchmarks show that Node.js offers better performance, while doing much more.

  • 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.

In Conclusion,

Of course, if you’re really picky, there’s no reason why you can’t mix it up a bit. Plenty of developers use MongoDB with Apache and PHP, and others prefer to use MySQL with Node.js. AngularJS works quite well with any server, even one running PHP to deliver data from MySQL. You don’t have to be a slave to the acronyms.



Published by


I am a Software Engineer by profession. I'm ever curious to find the latest technology in the field and put it to good use. Quite a bit of my free time goes to learn different tools and technology.I enjoy development for Linux, building/leading teams, and contributing to different open source projects. Even though I have a very wide range of interests when it comes to build software, my current focus is on Frontend development. I am thrilled to work with HTML,CSS,JS, JQuery and Ajax like concepts. I also love to read, write, travel and cook.

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 )

Google+ photo

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

Twitter picture

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

Facebook photo

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


Connecting to %s