LAMP vs. MEAN: Which Stack Is Right for You?
Looking for a new tech stack for your next project? Read on for a comparative look at these two popular stacks for web app development.
Join the DZone community and get the full member experience.Join For Free
A web stack is a collection of software or technologies that are used to build a web application. There are plenty of choices, but picking one can be hard.
When chatting with co-workers, developers or customers, suggestions for what technologies and stacks to use couldn’t be more different. When I started off as a web developer, I went the usual way at that time: learning HTML and CSS, exploring some PHP – and of course MySQL. That was, if you were not using Java or ASP.NET, the technology stack of that time. Whether you wanted to host a blog, a bulletin board or become an image hoster – you would more than often need these things: Linux, Apache, MySQL and PHP (LAMP).
Here is a detailed overview of LAMP and the relatively new MEAN stack, which are currently the most popular open source web stacks and a brief overview of other stacks. Whichever stack you choose, Bitbucket works with them all.
LAMP delivers a strong platform for developing and hosting large, performant web applications. With the biggest and oldest community, countless libraries and tools, you get great support and will find developers quite easily.
Its integral components are:
- Linux (OS)
- Apache (Webserver)
- MySQL (Data persistence)
- PHP (Programming language)
There are also some derivatives of this stack:
- LAMP (with Perl or Python instead of PHP)
- LAMP (with MongoDB instead of MySQL)
- WAMP (Windows as OS)
- MAMP (Mac OS X as OS)
- XAMPP (Any OS + Perl or PHP + FTP Server)
- LAPP (PostgreSQL as database)
LAMP Stack Pros
LAMP is kind of the dinosaur of web development, used by hundreds of thousands of companies and therefore maintained and supported very well. With endless modules, libraries, and add-ons available you can adapt it to your company’s needs.
Being Linux-based, you will find help for any topic in the large open source community. MySQL is a very reliable and scalable solution. PHP is in version 7 and is also supported by a mature and big community. PHP is also very fast and integrates well with the rest of the stack.
You can control the server and decide which versions and software you install, so you don’t have to depend on the client’s browser. It works best if you have lots of server-side tasks.
LAMP Stack Cons
Because it’s easy to learn, there are a lot of developers out there who are not following best practices and building garbage apps. Starting with PHP is easy, but mastering it is hard. This is also true for security in these PHP apps. Some would also describe it as a scripting language instead of a real programming language because it’s not strongly typed and not pre-compiled. I’d recommend diving deeper into the pros and cons of PHP, Python, and Perl.
MongoDB is a popular and flexible document-based, NoSQL database, compared to MySQL’s relational database system. Angular helps build progressive and modern web apps.
Its components are:
- MongoDB (Data persistence)
- Express.js (server-side application framework)
- Angular (client-side application framework)
- Node.js (server-side environment)
This stack has some derivatives too:
- MERN (React instead of Angular)
- MEEN (Ember.js instead of Angular)
MEAN Stack Pros
MEAN Stack Cons
A Few Other Stacks to Consider
Windows Server / IIS / Microsoft SQL Server /ASP.NET
Not open source, but all components are from Microsoft, so it should work seamlessly.
LAMP (With MongoDB)
Linux, Apache, MongoDB, PHP
NoSQL Databases like MongoDB can also be used in a classic LAMP environment.
Ruby/Ruby on Rails/RVM (Ruby Virtual Machine) / SQLite
This stack is losing popularity. Ruby on Rails was an often used framework once, and thus the whole stack.
Preferred by large enterprises and shied away from by indie developers for its complexity, Spring offers an entire full-stack framework written in Java.
Python / Django / Apache / MySQL
The Django framework is loved by Python developers, delivers performance, and is often referred to as an easy to learn stack.
Which Stack Is Used More Frequently?
I’d recommend checking development trends using Google’s trend tool from time to time.
I’d also suggest diving deeper into databases (SQL vs. NoSQL) to gain a basic understanding of the two concepts and make a choice.
So, How Do You Pick a Stack?
Picking a stack depends on many factors. If you are a developer or project owner, here are a few questions to ask yourself.
- What kind of web application am I planning to create?
- What is its expected lifetime?
- What technologies are available at my customer’s/client’s /cat’s/… infrastructure?
- How easy is it to find developers to maintain the application?
Let me give you an example. Let’s say you have a website for listing used cars. It was developed using a LAMP stack a while ago. But your website lacks a backend for used car dealers, where they can manage their listings on your website. Depending on your company size, time, and budget, you have to ask yourself all the above questions. If you have a small team, it might make sense to extend your existing application into a LAMP environment. Since your developers know the ecosystem and it’ll be much faster. If you have time and resources to spare, you could take another approach and extend your existing LAMP application with an API. Later, your team could focus on developing a small, standalone (M)EAN application, that can easily be maintained, improved with new features, and released using a much faster cycle.
Another example: You want to build a newsletter platform, where people can sign up, upload mailing lists, compose mail, and so on. You could of course use MEAN, but you have large scale and high traffic potential. It may make more sense to use a LAMP stack as your foundation, since Linux, MySQL, and Apache provide a stable, scalable environment with lots of community support for any problem. You will also have lots of server-side tasks and cron jobs and will encounter mailing topics like SMTP and so on. I would recommend a Linux environment customized to your needs in this case.
Here is a summary of things to know/consider.
If you are new to programming and web development, ask yourself:
- What is the easiest to learn for you and your team?
- What technologies are trending and which will win in the long run?
- If open source, could you imagine contributing to the project?
- Which technologies will serve you personally in the long term?
Published at DZone with permission of Christoph Heike. See the original article here.
Opinions expressed by DZone contributors are their own.