Uber has released Fusion.js, an open source "Plugin-based Universal Web Framework." In the announcement, Uber senior software engineer Leo Horie explains that Uber builds hundreds of web-based applications, and with web technologies changing quickly and best practices continually evolving, it is a challenge to have hundreds of web engineers leverage modern language features while staying current with the dynamic nature of the web platform. Fusion.js is Uber's solution to this problem.
In evaluating frameworks, it is crucial to understand their goals and purpose to determine if a framework is right for building an application. Horie explains that Uber:
Needed to revamp its aging monolithic web framework to something that addressed the challenges posed by the years-long accrual of technical debt. However, we also wanted to let engineers keep using the technologies they love (e.g., React, and Redux) while maintaining compatibility with Uber’s app health monitoring infrastructure.
To achieve this goal, Fusion.js addresses pain points identified by the Uber team:
- Configuration and boilerplate found when using many tools for server-side rendering, code splitting, and hot module reloading
- Challenges when abstracting aspects of server-side rendering
- Coupling of large code bases
- Tests when side effects occur
- General inflexibility with monolithic frameworks
The team at Uber found challenges when trying to make things work with existing solutions, as well as challenges with integration internationalization and other necessary features. There was also a primary goal to avoid monolithic approaches to Fusion.js to keep bundle sizes small.
Horie recommends Fusion.js for engineers who want:
An MIT-licensed JavaScript framework that supports popular libraries like React and Redux, and comes with modern features like hot module reloading, data-aware server-side rendering, and bundle splitting support.
Significant emphasis gets placed on Fusion.js applications being universal and plugin based. Fusion.js applications have a single entry point file, making it possible to reuse code on the server and client. Fusion.js plugins are universal, making it easy for developers to achieve similar benefits.
Beyond React and Redux, Fusion.js leverages Flow for typing and Koa for middleware management. In addition to supporting testing tools like Jest, Enzyme, and Puppeteer, Fusion.js provides tooling for developers to test plugins with the fusion-test-utils package.
The plugin architecture and desire to avoid a monolithic architecture is somewhat contrary to the recent trend in JavaScript to move towards monopackages. With the widespread adoption of ES modules, and tools such as webpack to handle code splitting, it has become much easier to reduce bundle sizes without needing to keep all packages separate. However, Uber's emphasis on small bundle sizes is a direct response to challenges their engineering organization has faced in building complex web applications.
Initial public feedback of the project is mixed, with some engineers questioning the use of Flow over TypeScript and some wondering why there's a need for yet another framework. It is too soon to tell if Fusion.js will gain traction outside of Uber, but it is encouraging to see organizations release infrastructure that they find beneficial.
Fusion.js is available under the MIT license. Contributions are encouraged via GitHub.