From LAMP to the new full-JS web stack with Node.js, MongoDB, jQuery, Backbone.js and other cool stuffin Development @ November 2, 2011
Since 1999 I have been developing my websites on the LAMP (Linux, Apache, MySQL, PHP) stack, and it has served me well. It was very easy to learn and get up to speed with PHP (a bit too easy maybe), while setting up Apache/MySQL for development work is trivial. The best part was, and still is, the plethora of straightforward and affordable LAMP hosting solutions, which have played a key role in the widespread adoption of PHP and its accompanying technologies.
As I like to keep myself up-to-date with new technologies and design/development paradigms, every time I want to learn a new technology I just create a new project (works better that a ‘hello world’ tutorial). When I was learning PHP/MySQL, I developed two gaming community websites: Noobwars and The-Core (the former has changed hands since then and the latter is no longer active), both full-blown news/community/CMS applications handwritten end-to-end. Then, as I was delving deeper into Flash & ActionScript, I redesigned my portfolio website in full-Flash (I know … I have seen the light since then!). When I wanted to get a better understanding of jQuery/CSS3/HTML5, I developed Penguspy.
Recently, I had an idea for a new project (more complex and involved), so I went out shopping for the latest and greatest in web technologies. With my background in PHP I started looking at PHP frameworks and one managed to impress me: Symfony 1.4. I went ahead, read the documentation, completed the tutorials and I was quite happy with it. But at that time (around May), a new version of Symfony was in the works; version 2.0. Based on the fact that my project will take about a year to go live, I thought it would be a good opportunity to start developing on the newer Symfony version, which is backwards-incompatible, in order to rip its benefits. Again, I went throught the documentation of the second version … twice. I want to emphasize their excellent documentation, where I learned lots of new things that will be useful to me even outside of Symfony. I particularly enjoyed the section on caching. In the end, I found Symfony 2 to be an amazing PHP framework, but it is so amazing (and so different than regular PHP) that in order to use it I basically have to re-learn everything from scratch and do things the Symfony-way. Well, if I have to learn everything from scrath I may as well go ahead and learn another language/framework.
For the MVC client part I am using jQuery + jQueryMobile with Backbone.js and Mustache. Backbone.js has gained lots of momentum as the framework for client-side MVC apps, while Mustache provides a very good template engine for your HTML code. I also evaluated Sencha Touch as an alternative MVC engine, but I found that its cons (the significant learning curve, the large file-size of the library and the fact that I would have to do everything the Sancha-way) outweighed the pros.
In regards to the database, the project requires lots of data manipulation due to its social nature and I was worried that a traditional relational database might not be the best solution, performance-wise, thus a NoSQL database seemed like a more appropriate fit (and of course, an opportunity to learn more about NoSQL DBs).
So, there it is, a full JS stack of technologies I am working with (and learning!) for the project:
- MongoDB (database)
- Node (web server & development platform)
- jQuery + jQueryMobile
- Mustache (templating)
This post turned out to be longer that I anticipated so I will leave out the part about choosing the right IDE, code repo/versioning, CSS/JS enhancers, hosting and more for a part 2. Overall, it is an extremely satisfying experience to work with and learn so many cutting-edge technologies on a very exciting project! I have learned so many new things in a very short period of time and although I had to spend some time searching for the most appropriate solutions, it was time well spent as it helped me improve my understanding on a number of development-related areas.
Although I am not an expert in Node (I am still learning), if you have been developing on LAMP since forever and want to try something cutting-edge and challenging (in a satisfactory way), I encourage you to give the full JS stack a try. It is a very different experience that might seem chaotic and overwhelming at first, but once you get used to it and understand the logic you will have a hard time going back.