web-sys provides bindings for all Web APIs and is a procedurally generated crate from WebIDL.

It's the defacto way to interact with a browser's DOM and other APIs.

It's part of a bigger project called wasm-bindgen.

A fair warning

Browser APIs are inherently un-safe. Any value in JavaScript may be null. As a result strong, static typed languages have to jump through hoops to assure that the programmer is working with the values they expect. In Rust this means doing a lot of maping and unwraping. The good news is that once you have a value, you really have it.


The web-sys crate is the low level crate that other Rust libraries and frameworks build on top of. It is the bridge between Rust and your browser.

It's a bit like Haskell's jsaddle and jsaddle-dom, which we use at Formation.ai.

It's also a bit like interacting with your browser in JavaScript using the web dev console. Very useful, but probably not the best way to structure large web applications.