Seed is a frontend Rust framework for creating fast and reliable web apps with an elm-like architecture.
stable
Rust, no nightly
required!If you already know Rust and Seed or frontend development basics, the examples provided in the repository are a good place to get started. They also act as an integration testing suite we run before every commit to ensure there are no unintended breaking changes to the user space. Because of Rust's compile-time checking, testing is that much more robust and changes can be pushed confidently.
You'll learn more about Rust and how to setup a new Seed project in next chapters, however if you are an experienced Rust developer and want to try something now - you can run examples with cargo make start example_name
from the Seed repository root.
Here's our counter example:
use seed::{prelude::*, *};
// `init` describes what should happen when your app started.
fn init(_: Url, _: &mut impl Orders<Msg>) -> Model {
Model::default()
}
// `Model` describes our app state.
type Model = i32;
// `Msg` describes the different events you can modify state with.
enum Msg {
Increment,
}
// `update` describes how to handle each `Msg`.
fn update(msg: Msg, model: &mut Model, _: &mut impl Orders<Msg>) {
match msg {
Msg::Increment => *model += 1,
}
}
// `view` describes what to display.
fn view(model: &Model) -> Node<Msg> {
div![
C!["counter"],
"This is a counter: ",
button![
model,
ev(Ev::Click, |_| Msg::Increment),
],
]
}
#[wasm_bindgen(start)]
pub fn start() {
// Mount the `app` to the element with the `id` "app".
App::start("app", init, update, view);
}
If you are proficient in a frontend framework, creating a standalone web app is painless. You'll notice minimal configuration:
├── Cargo.toml
├── Makefile.toml
├── index.html
└── src
└── lib.rs
We currently have two template repositories:
You may prefer writing in Rust and appreciate its benefits, including:
Our main focus is on developer experience, the benefits of which are currently: