Learn SEED-RUST with Real Code Examples
Updated Nov 25, 2025
Installation Setup
Install Rust via rustup
Install wasm32-unknown-unknown target: `rustup target add wasm32-unknown-unknown`
Install trunk for building: `cargo install trunk`
Create a new Seed project with `cargo generate --git https://github.com/seed-rs/seed-templates`
Build and serve locally with `trunk serve`
Environment Setup
Install Rust via rustup
Add wasm32-unknown-unknown target
Install Trunk
Initialize project from Seed template
Build and serve locally
Config Files
Cargo.toml - project metadata and dependencies
index.html - entry HTML
trunk.toml - build and asset configuration
src/main.rs - app entry point
components/ - optional modular components
Cli Commands
cargo install trunk
cargo generate --git seed-templates
trunk serve
cargo build --release
trunk build
Internationalization
Text handled via Model and Msg
Dynamic localization through Rust crates
Strings can be swapped per locale
Integration with JS i18n libraries possible
UTF-8 support ensured in Rust
Accessibility
Wasm runs sandboxed in browsers
Keyboard and screen-reader support via HTML
Components can expose ARIA attributes
Works with standard browser accessibility tools
Message-driven state ensures consistent UI updates
Ui Styling
CSS via static folder or frameworks
Class assignment in HTML! macro
Inline styles supported
Dynamic classes via Model state
Integration with Tailwind or Bulma
State Management
Model holds state
Msg triggers state updates
Update function processes messages
Components manage isolated state
Async tasks can dispatch Msg for updates
Data Management
Store state in Model structs
Fetch API or WebSocket for external data
Update Model via messages
Use serde for JSON serialization
No direct local storage unless accessed via web APIs