By the mid-2000s, a huge number of web apps were built upon the so-called LAMP stack. LAMP applications utilize the Linux operating system, Apache web server and MySQL database server, and implement application logic in PHP or another language starting with the letter “P,” such as Python or Perl. Although the LAMP stack was arguably less scalable or powerful than competing Java or .NET frameworks, it was typically easier to learn, faster in early stages of development and definitely cheaper. When enterprise architects designed systems, they often chose commercial application servers and databases (Oracle, Microsoft, IBM). But, when web developers or startups faced these decisions, the LAMP stack was often the default choice.
LAMP applications are still in widespread use; and, of course, Linux particularly continues to be the dominant server operating system. However, technologies based on the LAMP stack cannot easily provide the rich experience demanded by modern web applications.
We all experienced a relatively abrupt improvement in the richness and power of web applications in the middle of the last decade. Applications such as Gmail and Google maps provided interactive experiences that previously had been available only on desktop applications. This revolution was enabled by the programming pattern known as AJAX (Asynchronous JavaScript and XML), in which JavaScript within the browser communicates directly with backend services by transferring XML messages. XML was soon superseded by JavaScript Object Notation (JSON), which is a self-describing format similar to XML, but more compact and tightly integrated into the JavaScript language.
The use of JavaScript and AJAX in the browser has become ubiquitous in modern web applications, regardless of the backend technology. However, supremacy of JavaScript in the browser has encouraged the emergence of new middle tier technologies based on JavaScript.
For instance, the increasingly popular MongoDB database utilizes JavaScript object notation (JSON) as its native data model.
Having a data store that can natively store JSON reduces the impedance mismatch between Ajax code and database. But there is a further impedance mismatch between the logic written in JavaScript in the browser and the backend logic written in Java or.NET language. The desire to write everything in a single language – namely JavaScript – has led to the emergence of Node.js, an application server in which logic is defined in JavaScript code.
Express is a Node.js module that can handle HTTP routing – mapping URLs to code handlers – and process web page templates to simplify the tedium of generating dynamic HTML. Express has become the de facto standard for HTML/HTTP processing in Node.js.
Meanwhile, the Google-created framework AngularJS has gained traction as way of simplifying browser-side JavaScript coding. Developers at Google designed AngularJS to explicitly reduce the effort involved in constructing complex rich web applications such as Gmail and Google Maps. AngularJS follows the Model-View-Controller (MVC) pattern for separating presentation, data and application logic. It also utilizes the concept of dependency injection, which simplifies the client code by reducing the amount of service handling code required.
These four JavaScript-based components – MongoDB, Express, AngularJS and Node.js –have become known together as the “MEAN stack.”
The LAMP stack is now essentially obsolete technology, and the MEAN stack provides a lot of productivity advantages, especially for modern highly-interactive web sites. But the MEAN stack is not without compromise. Compared to expensive relational systems such as Oracle, MongoDB offers limited transactional support and business intelligence functionality, and is operationally complex at scale. Likewise, Node.js is a relatively new middle tier technology which may lack scalability, functionality and stability compared with Java-based middle tiers. Nevertheless, by providing an application development environment in which JavaScript is ubiquitous at all levels, the MEAN stack represents a significant productivity boost for web application developers.