MEAN Machine


This book is no longer available for sale.

MEAN Machine

A beginner's practical guide to the JavaScript stack.

About the Book

The Next Book is Coming

This book was written with Angular 1 in mind. With Angular 2 (now up to v4), we are preparing the next book. Check it out!

Angular Machine: The Practical Book to Angular v4+

Learn to write MEAN Stack applications from scratch

Want to learn Node.js and AngularJS?

In this book, we will be learning about four pieces of software (MongoDB, ExpressJS, AngularJS, and Node.js) and how they combine to make the great MEAN stack.

This book is suitable for beginners with no Angular or Node experience. Only a very basic knowledge of HTML and JavaScript is necessary. 

What You’ll Learn

For just $25, you’ll gain a great real-world understanding of how to use Node and Angular. You will also learn the following:

  • Build Node/Express applications and RESTful APIs from scratch
  • How to authenticate Node and Angular applications
  • Handle CRUD operations with MongoDB
  • Build dynamic Angular frontend applications from scratch
  • Build scalable and well-structured MEAN applications
  • Best practices and techniques in application development
  • Use Bower and Gulp for efficient development

This book is essentially three books in one. Getting Started with Angular, Getting Started with Node, and Building Applications with Node and Angular.

You'll have the knowledge to build not just MEAN apps, but standalone Node and standalone Angular applications as well. 

What You'll Build

  • RESTful API in Node and Express with token based authentication
  • Angular token based authentication 
  • MEAN stack CRM to manage users
  • Starter MEAN app with Bower and Gulp
  • And more...


You’ve probably heard of the MEAN stack around the web and have been wondering what’s so great about it. Building with the four MEAN components can create not only amazing applications, but also a faster and easier development process.

Having entire applications written in JavaScript makes development easier since you only have to deal with one language for the backend and frontend. This means your development time is shorter, your team can work better together, and your JavaScript knowledge can transfer across your entire development stack.

Code Samples

Code samples are provided in a GitHub repository to download and use for learning or within your own projects.

If you have any questions or comments, please don't hesitate to get in touch.

  • Share this book

  • Categories

    • Software
    • JavaScript
    • Node.js
    • MongoDB
    • Express
    • AngularJS

About the Authors

Chris Sevilleja
Chris Sevilleja

Chris and Holly met all the way back in their elementary school days and have been programming ever since. They enjoy learning new things and sharing their newfound knowledge. As founders/writers of, Chris and Holly provide quality web development articles to the masses in their spare time.

Holly Lloyd
Holly Lloyd

Chris and Holly met all the way back in their elementary school days and have been programming ever since. They enjoy learning new things and sharing their newfound knowledge. As founders/writers of, Chris and Holly provide quality web development articles to the masses in their spare time.

Table of Contents

  • Preface
    • Conventions Used in This Book
    • Code Samples
    • Get In Contact
  • Introduction
    • Why MEAN?
    • When To Use the MEAN Stack
    • When NOT To Use the MEAN Stack
    • Who’s Getting MEAN?
  • Primers
    • MongoDB
    • Node.js
    • ExpressJS
    • AngularJS
  • MEAN Thinking
    • Client-Server Model
    • Book Outline
  • Getting Started and Installation
    • Requirements
    • Tools
    • Installation
  • Starting Node
    • Configuration (package.json)
    • Initialize Node App
    • Creating a Very Simple Node App
    • Starting a Node Application
    • Packages
    • Recap
  • Starting a Node Server
    • Sample Application
    • Method #1: Pure Node (no Express)
    • Method #2: Using Express
  • Routing Node Applications
    • Express Router
    • Sample Application Features
    • Basic Routes
    • express.Router()
    • Route Middleware (router.use())
    • Structuring Routes
    • Routes with Parameters (/hello/:name)
    • Recap
  • Using MongoDB
    • Installing MongoDB Locally
    • Common Database Commands
    • CRUD Commands
    • GUI Tool: Robomongo
    • Using MongoDB in a Node.js Application
  • Build a RESTful Node API
    • What is REST?
    • Backend Services for our Angular Frontend
    • Sample Application
    • Getting Started
    • Starting the Server and Testing
    • Database and User Model
    • Express Router and Routes
    • Route Middleware
    • Creating the Basic Routes
    • Creating Routes for A Single Item
    • Conclusion
  • Node Authentication
    • Why Token Based Authentication Came to Be?
    • The Problems with Server Based Authentication
    • How Token Based Authentication Works
    • The Benefits of Tokens
    • JSON Web Tokens
    • Breaking Down a JSON Web Token
    • Authenticating Our Node.js API
    • Route to Get User Information
    • Modules to Help with Authentication
    • Conclusion
  • Starting Angular
    • The State of JavaScript Applications
    • Introduction
    • Important Angular Concepts
    • Setting Up An Angular Application
    • Creating and Processing a Form
    • Conclusion
    • ngRoute
    • Node Server for Our Routing Application
    • Sample Application
    • The HTML For Our App
    • Angular Application
    • Injecting Pages into the Main Layout
    • Configuring Routes
    • Configuring Views
    • Conclusion
  • Animating Angular Applications
    • Animating Our Routing Application
    • How Does the ngAnimate Module Work?
    • How Animations Are Applied
    • Directives that Use Animation
    • Animating Our Routing Application
    • CSS Animations and Positioning
    • Conclusion
  • MEAN Stack Application Structure
    • Sample Organization
    • Organizing Node.js - Backend
    • Organizing AngularJS - Frontend
    • Testing Our Newly Organized App
  • Angular Services to Access an API
    • Types of Angular Services
    • The $http Module
    • A Sample Angular Service
    • User Service
  • Angular Authentication
    • Hooking Into Our Node API
    • Authentication Service
    • The Entire Auth Service File (authService.js)
    • Conclusion
  • MEAN App: Users Management CRM
    • Setting Up the Application
    • Main Application
    • Login Page
    • Authentication
    • User Pages
    • Conclusion
    • Recap of the Process
    • Next Up
  • Deploying MEAN Applications
    • Great Node Hosts
    • Deploying to Heroku
    • Git Repository
    • Deploying Our User CRM App
    • View Our Application in Browser
    • Using a Current Heroku App
    • Using Your Own Domain
    • Conclusion
  • MEAN Development Workflow Tools
    • Sample MEAN App
    • Bower
    • Gulp

The Leanpub 60 Day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

Now, this is technically risky for us, since you'll have the book or course files either way. But we're so confident in our products and services, and in our authors and readers, that we're happy to offer a full money back guarantee for everything we sell.

You can only find out how good something is by trying it, and because of our 100% money back guarantee there's literally no risk to do so!

So, there's no reason not to click the Add to Cart button, is there?

See full terms...

80% Royalties. Earn $16 on a $20 book.

We pay 80% royalties. That's not a typo: you earn $16 on a $20 sale. If we sell 5000 non-refunded copies of your book or course for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

In fact, authors have earnedover $13 millionwriting, publishing and selling on Leanpub.

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub