Flux implementations for AngularJS and Backbone.js

Posted by Sami Tikka on February 16, 2016

I like Flux architecture, it seems to provide an elegant solution for facilitating data exchange between UI components. I was looking for a collection of few classes/services, which would provide the Flux architecture and allow it to be used along with other frameworks. Many implementations however build on top of the underlying framework and wrap it, making the implementation quite fragile when the underlying framework is updated.

Flux is basically a really simple idea, but it also seems to be over-engineered in many places. My takeaway from the pattern is a common event dispatcher, which notifies stores of user actions. Stores process those actions, and again notify components and other stores that have subscribed to them. Components then fetch the data from stores and update their view.

I built implementations of Flux for Backbone.js and AngularJS. The code if free to use and modify. Repository includes example code.