small medium large xlarge

Building Backbone Plugins


Cover image for Building Backbone Plugins

Building Backbone Plugins


Getting started with Backbone.js is fairly simple compared to most of the large frameworks. But it’s not without its perils and pitfalls. For all of the flexibility and freedom you have, it requires a lot of boilerplate—a lot of copy and paste code. But there’s hope. You can reduce the boilerplate code, cut your development time, and improve your app’s functionality by creating good abstractions. With Building Backbone Plugins, you’ll learn more than just the “how” of building abstractions, you’ll also learn the “why”!

This work was written and produced entirely by the author. We are proud to be distributing it.

About this Title

Pages: 194
Published: 2014-06-18
Release: P1.0 (2014-06-17)
ISBN: pending

Stop building apps with broken, boilerplate JavaScript. Master the art of extending and scaling Backbone.js by creating the add-ons, plug-ins, and abstractions that you need for your application.

With Building Backbone Plugins, you will:

  • Learn dozens of time-saving secrets
  • Build apps that can handle massive growth
  • Say goodbye to spaghetti-code solutions
  • Make better architecture decisions
  • Write maintainable, problem-free JavaScript
  • and more!

All with the goal of becoming a more productive developer, delivering high value web apps in record time. This book will teach you not only the “how” of building abstractions and add-ons, but also the “why,” “when,” and “where” of extending Backbone.js properly.

Written with years of experience in building dozens of large-scale applications for a wide variety of clients and web sites, this book delivers everything you need to master Single Page Application development with Backbone.js.

What You Need

To get the most out of this book, you will need a working understanding of the basics of Backbone.js. You should be familiar with building views, models, and collections, and how to make them work together.

A working knowledge of JavaScript is also needed. This book briefly covers some more advanced issues and techniques with JavaScript, but only in passing. Additional resources are listed throughout the book, as well.


Contents & Extracts

Part 1: Backbone Views (6 chapters)

In Part 1, you’ll learn how to eliminate boilerplate code in views by building a generic render method, then extending specialized view types from a custom base type. You’ll also learn how to add new view types that offer flexibility through code and configuration.

  • Chapter 1: View Rendering
  • Chapter 2: Naming and Namespacing Your Plugin
  • Chapter 3: Complex and Divergent Views
  • Chapter 4: Building a Better CollectionView
  • Chapter 5: Cache Pre-Compiled Templates
  • Chapter 6: Overriding Backbone.View’s ‘Constructor’

Part 2: Managing The DOM (3 chapters)

Part 2 focuses on how to create simple objects to manage DOM references as well as show and swap out views. Along the way, you’ll learn how to update views with new options, too. FInally, you’ll combine the ability to define views and manage the DOM into a single view type called a Layout.

  • Chapter 7: Managing DOM Widgets and Controls
  • Chapter 8: Swapping Views in the DOM
  • Chapter 9: Managing Nested Views

Part 3: Data and Metadata (4 chapters)

Part 3 looks at how to create plugins that allow models to be selected, or “picked”, and collections that are also able to track which models have been picked. You’ll learn how to mix functionality into models and collections in a way that avoids troublesome method or attribute name collisions.

Part 4: Application Infrastructure (4 chapters)

Part 4 dives into how to build the basic infrastructure needed for scaling Backbone applications by feature set. You’ll discover how to create new building blocks to facilitate feature separation and communication between them. Last, you’ll learn how to segment and organize code within larger features, giving you the power to re-organize or modify features and functional areas of your app much more easily.

  • Chapter 14: Third-Party Events, Commands, And Requests
  • Chapter 15: Boot-strapping A Backbone Application
  • Chapter 16: Application Workflow
  • Chapter 17: Building With Components

Part 5: Resource-Rich Appendices

Pages and pages of additional, deep-dive content on a wide range of topics, including:

Managing Events As Relationships, The Three Stages of App Initialization, Better JavaScript Mixins, Theme and Variation, and more …


Derick Bailey is a consultant, entrepreneur, developer, and author, living in Waco, TX. He’s been slinging code since the late 80s and doing it professionally since the mid 90s. He blogs at, produces screencasts at, runs a podcast audio service at, and more!

Jerome Gravel-Niquet is an entrepreneur and a web developer. He was a designer. Then he brought his designs to code. Then he created back-ends. Then he worked with servers. Now, he builds products from start to finish. He built Backbone Todos and DocumentUp. He designed Timely. Blog.