Twitter open-sourced their webapp framework called Flight. I was starting on a webapp and thought I would give it a go. I have only worked with it for two or three weeks, but it has left a lasting impression.
A different take from conventional MV* frameworks
Flight takes a fundamentally different approach from the typical Model-View-* frameworks. Instead of organizing code around models and views, Flight divides an application into independent components that communicate exclusively through events. Each component is self-contained — it owns a piece of the DOM and responds to events triggered by other components, without any direct references between them.
This event-driven architecture means components are highly decoupled. You can add, remove, or modify a component without touching the rest of the application, as long as the events it emits and listens to remain consistent. Flight also supports mixins, which let you extend components with reusable behaviour — a lightweight alternative to classical inheritance.
How I used Flight
I adopted Flight for a new webapp and found the component model refreshing. Defining a component involves attaching it to a DOM node and declaring the events it triggers and listens for. Because components never reach into each other's internals, the codebase stayed modular even as features grew. The mixin system proved useful for sharing common functionality like data fetching and UI state toggling across unrelated components.
Some Talking Points
- True independence: Components know nothing about each other — only about the events flowing through the application.
- Mixins over inheritance: Flight favours composition via mixins, keeping components focused and avoiding deep class hierarchies.
- DOM-centric: Each component is bound to a DOM node, making it straightforward to reason about what controls what on the page.
- Contrast with MV*: Where frameworks like Backbone or Angular centre on models and controllers, Flight centres on events and isolated components.
If you're curious about building on top of Flight, I later explored combining its event-driven philosophy with MV* ideas in Icarus: A new JavaScript framework.