MEAN vs. LAMP Stack: Pros and Cons

Web stacks have evolved over decades with advancements in technology and backend languages. Two of the most popular web stacks currently are LAMP and MEAN. They rely on two different technologies for backend languages, databases, and server environments. The “stack” term refers to technologies that stack on top of each other in order to create a web server environment.

In this article, I’d like to clarify these two web stacks by looking at their technology choices, both pros and cons. Where does each stack excel? And what types of projects would benefit the most from either option? If you’re new to web technologies or just want to learn about these two stacks, then this guide has everything you’ll need.

Getting Started with Fullstack Web Development

Getting Started with Fullstack Web Development

These days, modern full stack development is very popular in both small agencies and larger companies with a…Read more

Traditional LAMP Development

Most developers should know about the traditional LAMP stack because it’s been around since the early web. LAMP stands for Linux, Apache, MySQL and PHP. Each of these are individual software packs that are combined to form a versatile server solution.

The biggest reason to stick with LAMP is security and widespread support. It has been around for decades, and it’s a proven method of hosting websites.

All the backend tech like PHP and MySQL are well known, and supported by every major hosting provider. If you work on a LAMP stack you can basically host anywhere. Additionally, you get access to the most popular CMS engines. WordPress, Drupal, and Joomla all run on PHP/MySQL.

Lamp Stack Icon

There are customizable options within the LAMP architecture such as LEMP replacing Apache with nginx. You could also run a variant on a Windows server as a WAMP stack.

However all the core software – including Apache, MySQL, and PHP – were open-sourced, and made primarily for Linux. This is why Linux makes the most sense for a server environment, and that’s why LAMP has stood the test of time for modern web development.

Most developers go this route because it’s the simplest way of getting a website online. You’ll find lots of support on forums that cover everything you need to configure and troubleshoot a LAMP environment. For instance, you can check out this ServerFault question for more info.

JavaScript Backend with MEAN

Node.js is the newest technology for developers determined to run scalable applications built with JavaScript. Node powers the MEAN stack, and offers a primary advantage: everything runs on a single language.

MEAN stands for MongoDB, Express.js, Angular.js, and of course Node.js. This acronym places no requirement for a server operating system or server software. A MEAN stack can run on any OS, and Node even comes with its own server to handle JS on the backend.

Mean.io

You’ll find lots of documentation and support on the Mean.io website.

Although this stack has gained lots of attention, it still has nowhere near the amount of stable support as a traditional LAMP stack.

So why would anyone go with MEAN? Because it’s ultimately faster and easier to scale. MongoDB is a NoSQL database which optimizes queries. The use of fullstack JavaScript also improves development because one language applies for all frontend and backend work.

Plus many other JS frameworks are hitting the market as stable solutions. For example, MEAN can be switched over to a MEEN stack replacing Angular with Ember.

Ember.js

Programmers will love the MEAN stack because it separates code for maintainability and growth. This makes it easier to organize your JavaScript web apps so they run in a natural environment.

There’s a lot to learn on this subject, and that’s probably the biggest barrier to entry for new developers. Learning all the technologies required to manage a MEAN app can take months. But if you love Node, and want to run everything on JavaScript this is well worth the effort.

Here are some beginners’ tutorials to get you started.

PHP vs. Node

PHP has been around since the mid-90s, and is truly the most popular backend language. Many web developers start with (or eventually learn) PHP because it’s so predominant across web platforms and hosting providers.

Node is a newer framework but its popularity has risen extraordinarily fast. This includes the popularity of NPM as a package manager for web developers, and expands further into powerful frontend frameworks such as Angular 2.

Angular2

The other benefit of Node is that it comes with its own web server. JavaScript is at the root of everything on a MEAN stack, so if you love JS then you’ll really love building MEAN web apps.

Many developers feel that PHP is a poorly-designed language because the creator, Rasmus Lerdorf didn’t actually design it as a language. PHP started as a generic solution for websites, and quickly grew into a big library of unrelated functions.

But with PHP 7 attempting to fix many errors of the language, and with free OOP frameworks, such as Laravel, PHP is a much better language now than it’s ever been.

Lavarel Code in Code Editor
IMAGE: Stackoverflow

So the language debate comes down to your personal choice. Do you really love writing JavaScript? Then Node with a MEAN stack might be worth considering.

If you already know PHP, and want to stick with what you know, LAMP is a viable route as well.

Overall Pros & Cons:

There are multiple layers of each web stack to compare, including operating system, server software, database, and backend language.

(1) The MEAN stack also includes Angular which is a frontend framework. There isn’t any required framework in a LAMP stack, but you can always add your own to any app you build.

(2) With regards to OS, the LAMP stack looks for a derivative of Linux. Linux is typically the best choice for a server environment regardless of stack, and it’s true of MEAN as well.

(3) Now the server’s OS is just the computer software, but it’s not the web server software. To get this you need a program like Apache or nginx. LAMP uses Apache because it’s one of the most stable choices available.

Nginx

(4) MEAN uses the Node.js server which is part of the Node package. It’s still fairly new, and while there is plenty of support out there, Node has nowhere near the same size community as Apache.

(5) Also a Node server requires a backend of JavaScript (without extensions). Apache allows most backend languages, and there are many free extensions for greater support. But as of right now Apache has nothing for Node support.

(6) Database management is where you’ll find the largest difference. LAMP uses MySQL for relational data storage, while MEAN uses MongoDB which is a non-relational database. Non-relational DBs are much faster, and provide an easier method of scaling with higher traffic.

MongoDB Logo

(7) Keep in mind that PHP isn’t limited solely to MySQL. It can use MongoDB and other alternatives like PostgreSQL or SQLite. It’s just that most PHP developers know MySQL, so it’s the main contender for a typical LAMP stack.

(8) MEAN stacks typically run faster and scale larger, but require a lot more time and server knowledge to learn the system. LAMP stacks are tried-and-true, and they come out-of-the-box with the most secure infrastructure and the widest support imaginable.

(9) Programming languages make a major difference between the two stacks. LAMP primarily works on PHP which includes WordPress and the Laravel framework. MEAN works on ExpressJS/NodeJS for the backend with AngularJS on the frontend.

(10) MEAN is full-stack JavaScript, and there’s a lot you’ll need to learn to get that running. It’s a frequent choice of new startups willing to push the boundaries in web app development. LAMP is more traditional with JS on the frontend, PHP on the backend. It’s made for people who just want to get websites online without too much worries.

Please check out this comparison guide to learn a little more. Neither choice is right or wrong, just different and made for different projects.

Wrapping Up

I’d say most websites lean towards the LAMP stack because it’s tested, and has lots of helpful Q&A threads indexed in Google. MEAN is still growing and also has plenty of support, but may be more technical than most people want to deal with.

Feel free to try both, and see them for yourself. It’s possible to install both setups locally on your computer, and build on them without a remote server.

And if you’re looking for more info on either stack, I’ve collected a set of handy links below.

FacebookTwitterInstagramPinterestLinkedInGoogle+YoutubeRedditDribbbleBehanceGithubCodePenEmail