This book is for web developers wanting to learn how building web applications has changed. The book assumes a basic knowledge of JavaScript. Knowledge of Node or Angular is helpful as well but not required.
Why I Wrote This Book
Ive been a web developer since 2004 and have professionally worked with most of the major web platforms. I love to seek out new technology that helps me write my applications better.
Applications built with an MVC framework such as Angular has been the largest paradigm shift that Ive seen in the web community. Frameworks and tools have come and gone, but client-side MVC applications are fundamentally different.
Ive been impressed with the quality of applications that Ive shipped with Angular and Node. The tools are simplesometimes a bit navebut this simplicity comes with the fantastic ability to iterate on features and maintain a codebase.
Applications such as those built with the MEAN stack are becoming more popular, but many development teams still feel comfortable with server-generated pages and relational databases.
Ive had such good luck with MEAN applications that I want to share my knowledge of how to build them with you.
I hope youll enjoy exploring this new method of building applications with me. I love discussing these topics, so feel free to reach out to me on Twitter to continue the conversation.
Jeff Dickey
@dickeyxxx
August 2014
Introduction
The JavaScript community has a strong belief in the power of composability when architecting software. This is in line with the Unix philosophy of simple components that can be used together to quickly build applications.
By no means is this methodology the only one that exists. Ruby on Rails, for example, uses an opinionated framework to make decisions for you about what your application should look like. Opinionated frameworks offer the advantage of being able to quickly learn an application because out of the box it worksyou just need to fill in the gaps. Opinionated frameworks are also easier to learn because there is usually a right way to do something. The downside is that youre limited to building applications that the framework was made for, and moving outside of the use cases the framework was made for can be difficult.
By contrast, the composition methodology is more flexible. Composing simple pieces together has a clear advantage of allowing you to build anything you want. These frameworks provide you with building blocks, and its up to you to decide how to put them together. The downside is mostly in the learning phase. Its difficult to know what is a good idea and what is a bad idea without having experience doing both.
For this reason, its useful to read up on opinionated guides for how to build JavaScript applications. These opinions provide one persons viewpoint on good and bad decisions and give you a road map to what an application should look like.
This book shows you how to build your own MEAN application following my opinions of what a good application should look like. These opinions come from my experience developing applications. While I have a good amount of experience, its unlikely it will fit perfectly with any other one person. For this reason, I find books such as this are useful to learn not just the how of using a tool set but the why as well.
In other words, its useful to know how to use promises in Node but not very useful if you dont understand why theyre useful.
The application you will build is called simply Social App (see .
FIGURE I.1 Social app
The application is similar to Twitter. Users can create an account and add posts. The feature count is not large but does consist of some neat solutions such as WebSockets that immediately display new posts to all users viewing the application. Ill also go over compiling the CSS and JavaScript assets with Gulp, deploying the application to both Heroku and Digital Ocean, building a clean, maintainable API and more.
Having a newsfeed that displays live, updating content is a pattern that I see on just about every project I work on. I chose this as an example because it is complicated enough to incorporate many different tools but not so complex that you will become bogged down in the minutiae of this specific application.
This application is also easily extensible. I encourage you while reading this book to take the time to not only implement the application as I have done but to build features of your own. Its relatively easy to follow along and build the same application, but you know thats not how software is actually written.