$ show DioxusLabs/dioxus
Dioxus is a Rust-native, cross-platform UI framework for building web, desktop, mobile, and fullstack applications with a single codebase. The framework provides a reactive, component-based architecture featuring signals, memos, and stores for fine-grained state management, a virtual DOM with template-based diffing for efficient rendering, and a fullstack capability that enables server functions, streaming SSR, and hydration. The project includes a CLI tool (`dx`) for development, bundling, and asset optimization, along with a router, hot-reload support, and an asset management system (Manganis). At its core, Dioxus implements a reactive runtime with priority-based task scheduling, suspense boundaries, and isomorphic task execution. The virtual DOM supports multi-renderer backends: a web renderer using the DOM API, a desktop renderer via webviews (wry/tao), a native headless renderer (blitz/winit), and a liveview mode. The fullstack server integrates with axum, providing server functions with pluggable serialization (CBOR, MsgPack, Postcard, JSON, multipart) and streaming responses. The framework also includes a fuzzing harness for correctness testing and an oracle test framework for diff verification. Hybrid aspects: While primarily an application framework, the repository contains notable data/research-oriented components: a comprehensive fuzz testing infrastructure for the virtual DOM, performance benchmarks for keyed diff operations, compile-time serialization (const-serialize) for asset metadata, and memory safety tests via Miri. These elements demonstrate a strong investment in correctness and performance engineering.
The LLM identified 6 files worth highlighting for reuse:
Implements the core `Signal<T>` type with read/write access, automatic dependency tracking via `ReactiveContext`, derived signals through `memo`, and support for global signals. Provides a clean API with `Readable`/`Writable` traits and is used throughout the framework. This component is self-contained and demonstrates advanced reactive programming patterns, making it reusable in any Rust reactive system.
Defines the `Store` type and `SelectorScope` for fine-grained reactive state management. Supports deep tracking with `mark_dirty_shallow`/`mark_dirty`, and provides lens-based access via `GetWrite` for nested structures. The macro-generated extension traits (`#[store]`) enable type-safe derived state. This pattern is reusable for building complex state management solutions.
Contains the core diffing algorithm that compares VirtualDom nodes against a template cache. Uses packed operations (u16 ops) for efficient encoding of static and dynamic content. Handles keyed lists, attribute changes, text updates, and component scope swaps. The algorithm is optimized for the common case of template-based UI and is the foundation for efficient rendering across all platforms.
The JavaScript interpreter that applies mutation instructions from the Rust virtual DOM to the actual DOM. Implements a custom protocol for creating, updating, removing, and reordering DOM nodes without innerHTML or React-style reconciliation. Supports streaming hydration, event delegation, and fine-grained updates. This file is a highly optimized single-function that demonstrates deep browser API knowledge and is critical for web performance.
Implements a pluggable payload encoding for server functions using CBOR. Provides `FromRequest`/`IntoResponse` implementations for Axum and client-side serialization/deserialization. This modular pattern (also with MsgPack, Postcard, JSON) allows developers to choose encoding per endpoint. The code is isolated and reusable for any Rust HTTP service needing binary serialization.
Implements `AppManifest` which collects and organizes project metadata, assets, and build artifacts into a structured manifest. Handles asset hashing, bundling, and output paths across platforms (web, desktop, mobile). The manifest is used by the CLI for bundling and by the runtime for asset resolution. This component is reusable for any Rust project needing a portable asset pipeline.