5 Rust WebAssembly Frameworks for Your Next Application
Rust is fast, making the language a viable option for building WebAssembly programs. There are many Rust libraries and frameworks to help, with support for the tools you use to build web apps.
1. The Sycamore Library
To use Sycamore, you’ll need a recent version of Rust—the wasm32-unknown-unknown target. You’ll also need Trunk to build and bundle your application. Since Sycamore is new, it will be risky to use the main branch library in production, except if you resort to an earlier release.
2. The Yew Framework
You can get started with Yew using the Trunk application bundler or WASMPack. Check out the documentation for how to get started, interact with HTML and DOM APIs and transpile your Rust code to WebAssembly.
The Yew project is very popular, with over twenty thousand stars on Github and five thousand users. Yew is stable, but the project is not production ready, and the code base is changing, so you might experience errors and breaks.
3. The Percy Library
Percy is a collection of Rust libraries for building frontend web apps powered by WebAssembly. Percy supports instant server-side rendering. The project excels at building search-engine-friendly single-page applications (SPAs).
Percy provides an html! macro for generating virtual DOMs. You can render these into DOM elements in the frontend or use them for operations in the backend of your application.
Percy is still very new, and although the library is not production ready, the project is very popular, with over two thousand stars on Github.
4. The Seed Framework
Seed is a batteries-included, full-stack WebAssembly-powered framework for building fast web apps in Rust. The Seed framework provides a templating system that uses a macro syntax instead of Yew’s JSX-like syntax. It also has a built-in state management system to enhance productivity.
Seed is new, and pre-built components like date pickers are rare. Although Seed doesn’t currently support server-side rendering, the project aims to include it soon. Otherwise, Seed is feature-complete, and you can build production-ready web applications with it. Seed also uses the Elm architecture with minimal configuration. You can build and bundle your applications using Trunk, Web Bundler or Seeder.
You can also use Seed for the backend of your web application. Seed provides functionality for building REST or GraphQL APIs with routing and authentication support and AuthO integration.
The MoonZoon project philosophy is to create a very simple tool with no special terminology, artificial barriers, or dogma. Using it, you can focus on building web applications as you please. You’ll need to have WASM-Pack installed to build the front end. The backend of a MoonZoon application runs on Actix-web and Warp, both popular Rust backend frameworks. MoonZoon also provides authentication functionality.
The MoonZoon documentation isn’t hosted at the moment. To use the tool, you can check out the markdown files in the docs folder via the project’s GitHub repository.
You May Have Interacted With WebAssembly
WebAssembly was first released in 2017, and the World Wide Web Consortium (W3C) made WebAssembly a web standard in 2019. Since 2019, companies like Cloudflare, Google, and Dropbox have used the technology in production.
Google Earth uses WebAssembly, Cloudflare uses it for Cloudflare Workers, and Dropbox uses WebAssembly for a codec on its website.