UniFFI for React Native: Rust-Powered Turbo Modules
Article Summary
Mark Mayo from Mozilla and Tony Haile from Filament just open-sourced a tool that lets React Native developers write their native modules once in Rust instead of twice in platform-specific code. This could change how millions of developers build cross-platform apps.
Mozilla and Filament released UniFFI for React Native, a bindings generator that creates Turbo Modules from Rust code. It builds on Mozilla's UniFFI technology, which already powers critical systems in Firefox used by hundreds of millions of users. The tool generates TypeScript, JSI C++, and the glue code needed to call Rust from React Native seamlessly.
Key Takeaways
- Write native logic once in Rust instead of twice for iOS and Android
- Escape JavaScript's single-threaded bottleneck with multi-threaded Rust subsystems
- Tap into thousands of Rust crates for instant performance wins
- Already used in production: Matrix SDK for React Native built with it
- Mozilla uses UniFFI in Firefox for sync, telemetry, and experimentation
React Native developers can now build faster, memory-safe native modules in Rust with a single codebase instead of maintaining separate iOS and Android implementations.
About This Article
React Native developers have traditionally faced a choice between writing code twice, once for iOS and once for Android, or dealing with complex C++ implementations that are hard to maintain across platforms.
Mozilla and Filament built UniFFI for React Native, a bindings generator that takes a single Rust codebase and automatically produces TypeScript, JSI C++, and Turbo Modules. This eliminates the need for duplicate platform-specific code.
Johannes Marbach, with support from Unomed, has already used UniFFI for React Native in production to build a Matrix SDK library. The tool works for real-world React Native applications.