Backbone.js organizes JavaScript-heavy web applications with models, collections, views, and events, wired to a RESTful JSON backend.
Overview
Backbone.js gives structure to client-side web applications by separating data from the DOM. Models hold attributes with key-value binding and emit change events when data shifts. Views listen to those events and re-render themselves, while collections manage groups of related models with loading, saving, and aggregation helpers.
The design favors a small set of primitives: models and collections for data structuring, views and URLs for the interface. Business logic stays on the model side; views capture input and display state. Collections proxy model events so a single listener can react to changes anywhere in a set.
Persistence is aligned with REST by default. Collections and models map to standard HTTP verbs for list, create, read, update, and delete operations against resource endpoints. Optional jQuery integration supports AJAX and DOM work; Underscore is the required dependency.
The library is meant to sit inside existing sites rather than dictate layout or defaults. Teams use it where sprawling jQuery callbacks would otherwise keep UI, logic, and server data in sync by hand.
Key features
- Models with validation and sync
- Collections with enumerable helpers
- Views with declarative events
- Built-in event bus
- REST-aligned Model and Collection sync
- Router and History for URLs
- Optional jQuery integration
Use cases
- Rich single-page web clients
- Separating UI from business logic
- REST-backed JavaScript applications
- Incremental structure on legacy jQuery sites