5 Rust WebAssembly frameworks for your next app

WebAssembly (WASM) is a portable, low-level binary code format that runs on modern browsers just like JavaScript. In fact, WebAssembly is also interoperable with JavaScript. You can transpile most program source code to WebAssembly and run it on the browser with or without JavaScript.


Rust is fast, which makes the language a viable option for creating WebAssembly programs. There are plenty of Rust libraries and frameworks to help you out, with support for the tools you use to build web apps.


1. Sycamore Library

The-home-page-of-sycamore-1

Sycamore is a fast, ergonomic and intuitive SolidJS-like responsive framework. You can use it to build web apps in Rust that harness the power of WebAssembly. Sycamore provides most of the functionality you’ll need to build a web application interface in Rust, so you won’t need to write JavaScript.

Sycamore also provides router and JavaScript interoperability on Wasm-Bindgen using JS-sys or Web-Sys. The project intends to release the CSS tests and features soon.

To use Sycamore, you’ll need a recent version of Rust—the wasm32-unknown-unknown target. You will also need Trunk to create and bundle your application. Since Sycamore is new, it will be risky to use the main branch library in production unless you resort to an older version.

2. The yew frame

Yew is a Rust framework for building multi-threaded frontend web applications using WebAssembly. It lets you write Rust code and transpile your Rust code to WASM, which can run on any device that supports WASM. Yew is interoperable with JavaScript (you can use your npm packages), and the framework provides a macro for interacting with HTML elements with Rust, like JSX in React.

You can get started with Yew using the Trunk or WASMPack app bundle. See the documentation for how to get started, interact with HTML, and DOM-API 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 codebase is changing, so you may experience errors and outages.

3. The Percy Library

A screenshot of Percy's homepage

Percy is a collection of Rust libraries for building WebAssembly-powered front-end web applications. Percy supports server-side instant rendering. The project excels in creating single-page applications (SPAs) suitable for search engines.

Percy provides a html! macro to generate virtual DOMs. You can render them into DOM elements in the frontend or use them for operations in your app’s backend.

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 starting frame

A screenshot of the Seed homepage

Plant is a WebAssembly-powered, battery-powered comprehensive framework for building fast web applications in Rust. The Seed framework provides a template system that uses macro syntax instead of Yew’s JSX-like syntax. It also has a built-in status management system to improve productivity.

Seed is new and pre-built components like date pickers are rare. Although Seed does not currently support server-side rendering, the project aims to include it soon. Otherwise, Seed is complete and you can create production-ready web applications with it. Seed also uses the Elm architecture with minimal configuration. You can build and bundle your apps using Trunk, Web Bundler, or Seeder.

You can also use Seed for the backend of your web application. Seed provides functionality to create REST or GraphQL APIs with routing and authentication support and AuthO integration.

MoonZoon is an easy-to-use, full-stack, WebAssembly-supported framework for frontend and backend applications. You can write Rust without having to write HTML, CSS, and JavaScript on the frontend or REST, GraphQL, or SQL on the backend. MoonZoon is fast, simple, scalable and SEO optimized. It provides a CLI application for creating easy-to-deploy web applications.

The philosophy of the MoonZoon project is to create a very simple tool without any particular terminology, artificial barriers or dogma. By using it, you can focus on building web applications as you want. You will need to have WASM-Pack installed to build the front end. The backend of a MoonZoon application runs on Actix-web and Warp, two popular Rust backend frameworks. MoonZoon also provides authentication functionality.

MoonZoon documentation is not hosted at this time. To use the tool, you can view the markdown files in the documents folder via project 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.


Source link

Comments are closed.