Smithy

Build WebAssembly applications with Rust.

Write Idiomatic Rust

Smithy apps are written using idiomatic Rust code. You won't learn to build Smithy apps, you’ll learn Rust.

Component-Based

Smithy apps are built up from smaller components.
Encapsulation? Yes, please!

Typesafe

If you build a Smithy app, you give up very few of the compiler's guarantees. Smithy is the most typesafe framework for building WebAssembly apps using Rust.

Unopinionated and Boilerplate-Free

Manage your app's state however you want to. And don’t write extra code to do so.
Smithy will give you the support you need, and then get out of your way.

Write Idiomatic Rust

Smithy apps are written using idiomatic Rust code. You won't learn to build Smithy apps, you’ll learn Rust.

Component-Based

Smithy apps are built up from smaller components.
Encapsulation? Yes, please!

Typesafe

If you build a Smithy app, you give up very few of the compiler's guarantees. Smithy is the most typesafe framework for building WebAssembly apps using Rust.

Unopinionated and Boilerplate-Free

Manage your app's state however you want to. And don’t write extra code to do so.
Smithy will give you the support you need, and then get out of your way.

A Simple Smithy App

Every framework needs a hit counter example.
#[wasm_bindgen]
pub fn start(root_element: web_sys::Element) {
  let mut count = 0;
  let app = smithy::smd!(
    <div on_click={|_| count = count + 1}>
      I have been clicked {count} times.
    </div>
  );

  smithy::mount(Box::new(app), root_element);
}
smd!(
  <div
    on_click={|_| web_sys::window()
      .unwrap()
      .location()
      .set_hash("smithy")
    }
  >
    Click me to change your browser's hash
  </div>
)

Interact with Javascript

Use the web_sys, js_sys and wasm_bindgen libraries to interact with Javascript.

A Simple Smithy App

Every framework needs a hit counter example.
#[wasm_bindgen]
pub fn start(root_element: web_sys::Element) {
  let mut count = 0;
  let app = smithy::smd!(
    <div on_click={|_| count = count + 1}>
      I have been clicked {count} times.
    </div>
  );

  smithy::mount(Box::new(app), root_element);
}

Interact with Javascript

Use the web_sys, js_sys and wasm_bindgen libraries to interact with Javascript.
smd!(
  <div
    on_click={|_| web_sys::window()
      .unwrap()
      .location()
      .set_hash("smithy")
    }
  >
    Click me to change your browser's hash
  </div>
)