Oxirast
The fine-grained, lightning-fast WebAssembly framework for Rust.
Why Oxirast?
Most frontend frameworks rely on a Virtual DOM โ when state changes, they re-render your entire component, diff a new VDOM tree against the old one, and patch the real DOM. This diffing step is expensive and grows with your component tree.
Oxirast takes a fundamentally different approach: Fine-Grained Reactivity.
State lives in Signals. When a Signal mutates, Oxirast does not re-render the component. It reaches directly into the live browser DOM and surgically updates only the specific text node or attribute that depends on that Signal. The rest of your tree is never touched.
| Virtual DOM (React) | Fine-Grained (Oxirast) | |
|---|---|---|
| State change triggers | Full component re-render | Targeted Signal update only |
| DOM update method | Diff + patch VDOM tree | Direct DOM mutation |
| Re-render overhead | O(component size) | O(1) per subscriber |
| Memory model | GC-managed heap (JS) | Rust ownership + Wasm GC |
| Language | JavaScript / TypeScript | Rust โ WebAssembly |
Features
- ๐ฏ True Fine-Grained Reactivity โ Signals mutate, DOM updates. No re-renders. No diffing.
- ๐ฆ 100% Rust โ Write your entire frontend in one language with full type safety.
- ๐ Declarative UI via
rsx!โ HTML-like syntax compiled to optimised Wasm at build time. - ๐ Built-in SPA Router โ History-based client-side routing with automatic memory cleanup.
- โก Zero-Config CLI โ Scaffold, compile, and hot-reload with a single command.
- ๐งน Automatic Memory Management โ Wasm-to-JS garbage collector purges orphaned closures and Signals on page transitions, preventing memory leaks.
Workspace Structure
This repository is a Cargo workspace containing three crates:
oxirast/
โโโ oxirast-core/ # Runtime engine โ Signals, VNode, Router, DOM bindings
โโโ oxirast-parser/ # Compile-time procedural macro engine โ rsx! transformation
โโโ oxirast-cli/ # Developer CLI โ scaffold, serve with hot-reload
oxirast-core
The runtime engine. Contains the Virtual DOM, the Signal<T> reactivity system, the Router, async fetch hooks (use_fetch), the Context API (provide_context / use_context), and all wasm-bindgen DOM bindings.
oxirast-parser
The compile-time macro engine. Transforms your rsx! HTML-like syntax into optimised Rust/VNode instructions. Handles bind_text directive wiring and on_* event listener compilation.
oxirast-cli
The developer toolkit. A globally installed binary that scaffolds new projects and runs a hot-reloading development server at http://localhost:3000.
Quick Start
1. Install the CLI
2. Scaffold a new project
3. Start the dev server
Your app is now compiling to WebAssembly and running at http://localhost:3000 with hot-reloading enabled.
Usage
Components & the rsx! Macro
use VNode;
use rsx;
Reactivity with Signals
use ;
use rsx;
Single Page Routing
use ;
use rsx;
Cargo.toml Dependencies
Add the following to your project's Cargo.toml:
[]
= "0.1.1"
= "0.1.1"
= "0.2"
[]
= ["cdylib"]
Project Structure (Scaffolded App)
my_app/
โโโ Cargo.toml
โโโ Cargo.lock
โโโ public/
โ โโโ index.html # HTML shell โ Oxirast mounts into <div id="root">
โ โโโ style.css # Global styles
โโโ src/
โโโ lib.rs # Entry point & Router configuration
โโโ pages/
โโโ home.rs
โโโ about.rs
Roadmap
-
Signal<T>fine-grained reactivity -
rsx!macro โ HTML-like declarative UI -
bind_textdirective -
on_*event listener attributes - Client-side SPA Router with History API
-
use_state/use_fetchhooks - Context API (
provide_context/use_context) - Automatic Wasm-to-JS GC (memory reaper)
- Zero-config CLI (
init+serve) -
oxirast-cli buildโ optimised release builds withwasm-opt -
oxirast-cli clean -
--templateflag forinit -
oxirast.tomlproject configuration - Server-Side Rendering (SSR)
- Component hot-module replacement (HMR)
-
bind_attrdirective for reactive HTML attributes
Contributing
Contributions are welcome. Please open an issue first to discuss any significant changes.
- Fork the repository
- Create a feature branch โ
git checkout -b feat/your-feature - Commit your changes โ
git commit -m "feat: add your feature" - Push to the branch โ
git push origin feat/your-feature - Open a Pull Request
License
MIT License ยฉ Michael (kinuthia)
See LICENSE for the full text.