With the advent of WebAssembly, browsers are no longer a JavaScript-only environment. They are now capable of executing code written in low-level languages, and one of the main contenders for the role of JS’s new companion is Rust. This language has long been established in system development, but in recent years has increasingly become part of client applications – and for good reason.
Rust offers a strict type system, compile-time security, and minimal runtime overhead. Combined with WebAssembly, this allows resource-intensive calculations from JavaScript to be brought into a more predictable and performant environment. Such use cases are increasingly common in development, from audio and video processing to simulation, machine learning, and gaming. Examples include Figma, which is partially written in C++ and WebAssembly, or AutoCAD Web, which uses similar approaches.
To integrate Rust into a browser, wasm-bindgen, a set of tools and macros that links Rust and JavaScript, is used. It allows you to export functions, structures, and classes from Rust, make them available in JS code, and vice versa – call JS functions from Rust. In conjunction with wasm-pack, you can conveniently package all of this into an npm library suitable for use in any modern frontend project.
Rust is compiled into WebAssembly using the standard rustc compiler, and the target architecture is specified as wasm32-unknown-unknown. After that, all that’s left is to build the project and plug it in the browser – either manually via fetch and WebAssembly.instantiateStreaming, or using bandlers like Webpack, Parcel or Vite.
Parcel is particularly interesting here. Unlike Webpack, Parcel requires minimal customization. It automatically recognizes .wasm modules, plugs in dependencies, and even handles the glue code necessary for proper interaction between Rust and JS. In practice, this means that the developer can focus on logic rather than configurations. This integration makes it possible to move performance-critical pieces of code from JS to Rust without significantly complicating the architecture.
However, there are limitations. Despite the power of WebAssembly, its interaction with the DOM remains under the control of JavaScript. This means that it is not yet possible to use Rust as a full-fledged replacement for JS in interfaces. Nevertheless, as a computational kernel Rust shows itself perfectly. Code profiling confirms that operations written in Rust and compiled in WebAssembly are 2-10 times faster than JS equivalents depending on the task.
All this makes Rust+WASM a real tool for everyday web development, especially when it comes to heavy computations, cryptography, working with data streams or developing cross-platform components. More and more open-source projects are appearing in this bundle, including libraries that can be plugged in as npm packages. For example, the wasm-image library for image manipulation or wasm-md5 for hashing.
We are at the beginning of a transformation: the browser no longer belongs exclusively to JavaScript. Thanks to WebAssembly and languages like Rust, it’s becoming a true platform for high-performance computing. And while the journey is not yet complete – debugging, integration and compatibility issues remain – the direction is clear. Rust makes it possible to write fast, secure, and predictable code that can now run directly in the browser. This is computing in a new way.