Discord Ditches Electron and React Native, Embraces Rust for Enhanced Performance and Unified Client Experience
Discord has unveiled a major architectural overhaul, transitioning its desktop and mobile client applications from Electron and React Native to Rust. This strategic move is driven by a pursuit of superior performance and a more unified client experience. Initial demonstrations reveal remarkable improvements, with desktop startup times reduced to under one second and memory consumption plummeting from approximately 1GB (Electron) to a mere 290MB. The client also boasts significantly faster UI interactivity. For desktop, Discord is leveraging GPUI, a native UI rendering library also utilized by the Zed code editor, to build its interfaces. On mobile, rather than re-rendering UIs from scratch, Rust will directly manipulate the native UI components provided by iOS and Android. A key aspect of this migration is the development of a shared Rust core, which will encapsulate core application logic, facilitating reusability across desktop, mobile, and potential future platforms like VR or CLI tools, streamlining development and ensuring consistent functionality.
This move by Discord highlights a growing industry trend towards Rust for client-side applications, following similar decisions by other tech giants. Notably, Shopify announced two months prior its departure from React Native for mobile development, opting for platform-specific native code – a different approach to Discord’s unified Rust core strategy. The burgeoning Rust UI ecosystem is further evidenced by projects like GPUI gaining traction, prompting critical discussions within the community regarding rendering optimizations and best practices. Furthermore, Expo, a prominent player in the React Native ecosystem, is developing Exact, a Rust-based multi-platform framework designed to build web, iOS, macOS, and eventually Android and Windows applications from a single codebase without relying on JSX or React-style rendering. While not a mandate for all JavaScript-based projects to immediately migrate, these developments signal Rust’s increasing viability for large-scale, performance-critical client applications. Developers are encouraged to evaluate Rust for scenarios demanding high performance, system-level control, and cross-platform code sharing, particularly as its UI frameworks continue to mature rapidly.