From LAMP to MERN: Understanding similarities and differences
Tags: webdev, node, php, react
Published: 2020-03-24 09:00:14

Not so long ago, when I started my journey as a Full Stack Web Developer, the stack that appealed to me the most was initially the LAMP stack. This is because I love Laravel but, like many others, I have seen myself inevitably adapting to more updated stacks like the MERN stack.
In this article, I will talk about how I used my understanding of the LAMP stack to move on to MERN stack, and caught up with the JavaScript-as-a-server-side-language trend.
Let’s start by breaking both stacks down:

LAMP:
- L: Linux Operating System ( I am not mentioning WAMP because I simply hate Windows ).
- A: Apache HTTP server.
- M: MySQL Relational Database Management System.
- P: PHP programming language (Could be Python or Perl).
MERN:
- M: MongoDB Database Management System.
- E: ExpressJS Web Application Framework for NodeJS.
- R: ReactJS, a JavaScript library for building User Interfaces (UI — Frontend).
- N: NodeJS server, or just call it Server-side JavaScript.

Okay, great… and?

Well, let’s cross-match a little bit... And in order to do so, let’s think about how the app communicates internally across its stack elements.
-
First, the most important difference between the stacks are the languages used on the server. A LAMP stack application communicates with its server (Apache) using the P (PHP, Python or Perl), while a MERN stack application communicates with its server (NodeJS) using the N (NodeJS). You might ask yourself, what the heck is that supposed to mean?… Turns out that, until recent years, JavaScript could only run on the browser, meaning that it handled data only on the front-end of an application. But then came NodeJS, a runtime environment that allowed JavaScript to run on the server. That is why we call NodeJS the server-side JavaScript. So cross-match number one: (N)odeJS is to the MERN stack what (P)HP and Apache are to the LAMP stack. Paradox.
-
Second, a server-side language is a good thing but, a server-side framework is even better. Here is where our stacks’ cross-matching goes a bit off. PHP has frameworks that allow it to simplify server creation and management (Laravel, Symfony), and so does NodeJS. The difference is that, the framework NodeJS uses to manage and delegate server requests is actually part of the MERN stack… you’ve guessed it! It is Express JS, which leads us to our cross-match number two: ExpressJS is, to NodeJS in the MERN stack, what PHP (Laravel, Symfony) is to Apache in the LAMP stack.
Reality is, NodeJS does not need ExpressJS to create an HTTP server, just as Apache does not need Laravel or Synfony, but does need PHP, Python or Perl. ExpressJS is a framework that simplifies the creation and development of a NodeJS server.
-
Third, so far we have mostly talked about LAMP’s and MERN’s respective servers, and the respective server-side languages for each. Now, let’s talk about the why. Databases.
This is a pretty obvious but, interesting cross-match: While LAMP uses an SQL based database management system, MERN uses a JavaScript based database management system through the use of JSON-like syntax. This is where you notice the power of MERN… it is simply JavaScript all accross.
In the LAMP stack you have to worry about handling SQL, PHP and maybe even some JavaScript for the front-end.
For the MERN stack, learning JavaScript gives you a whole stack foundation of knowledge.
I mean… it is 3 vs. 1 language, you tell me what’s simpler…
Anyways… cross-match number three: MongoDB is to the MERN stack what MySQL is to the LAMP stack.
-
Fourth crossmatch… ReactJS is to the MERN stack what nothing is to the LAMP stack.
Here is the funny thing… You could actually use ReactJS to style the front-end of a LAMP stack application, and you probably know that but, notice how there is no accountability for a technology that handles the front-end responsibility in the LAMP stack. This is because the LAMP stack architecture is more server based than client based. The elements of the LAMP stack do not mention any User Interface related technologies while the MERN stack does (ReactJS).
-
Finally… a stack is a stack but… In my junior, humble opinion, unlike the LAMP stack definition, the MERN stack definition pretty much covers all the elements of a modern web app:

- MongoDB, a database management system;
- Express, a speedy and simple server-side framework;
- React, a technology able to create modern UIs;
- Node, a flexible server-side language and server environment.

Note that all the elements of the MERN stack were built with JavaScript in mind, and that JavaScript is in fact, The Web-App Development Language.
This is my humble perspective on the similarities and differences between the most used web app stacks today. I might be wrong about some things so feedback on my opinion is very welcome!
Thank you for reading on through the very end, and I hope this article helped you in any way possible!
If you liked it, please give this article a thumbs up and share it with fellow developers.
Now, get your eyes back on your editor!!!