Porting a JavaScript App to WebAssembly with Rust (Part 1)



  • Maintaining Software that is written in a dynamically typed language like JavaScript is costly. Maintaining a JavaScript frontend that is build with React, NPM, WebPack and Babel is even more expensive. Frequently we had situations where we just wanted to upgrade a single dependency or a WebPack plugin resulting in hours of fixing compatibility issues. Moreover due to the characteristics of dynamically typed languages you'll never really know if the upgrade of a library causes errors during runtime.

    In the past we didn't really had an alternative to JavaScript/NPM. Of course there is the wonderful purely functional elm language that offers the possibility to write reliable web frontends. But once you want to leave the functional elm world (e.g. to interact with the JavaScript API) you'll have to spent a lot of time for building "bridges".

    The rise of WebAssembly (WASM) is a great oportunity to combine the power of the JavaScript world with the compile-time guarantees and runtime performance of Rust.

    Within the last two years the Rust community created over 10 web framworks that could be used to build web frontends with WASM. Most of them are proof-of-concepts but a few are serious projects.

    We want to do a reality check of how far we could get using Rust as a frontend language. To do so we have choosen Seed as one of the more mature framworks.

    Moreover we want to demonstrate a real-world usecase instead of implementing just one more TODO list app. This is why we're going to port the complete frontend of kartevonmorgen.org to Rust. The Karte von morgen is an open source project for mapping sustainable initiatives and organisations.

    Let's get started 🙂

    https://slowtec.de/posts/2019-12-20-porting-javascript-to-rust-part-1.html



A community for developers looking to put WebAssembly to use today. Come rock WebAssembly with us!