Building A Web Application With Rust And Webassembly

The Vercel platform makes it a collaborative experience with deploy previews for every code change, by seamlessly integrating with GitHub, GitLab, and Bitbucket. Build an optimized, secure, and frontend-independent application for multi-platform deployment. Like any critique, it begs for a prescription and I didn’t give one, other than gesturing toward server-side frameworks like Rails and Django. I had queued up some time to really dive into the frameworks, but things like walking in parks have taken priority, so here’s just a grand tour. Today, GraphQL is being used by several production apps across PayPal. It is now a default pattern to use GraphQL for building new UI apps.

Pages are assemblages of components and are components themselves in yew. And finally, Services are auxiliary utilities to wrap low-level features or external services such as an HTTP client, Storage… For example, the Login page matches the /login route. Every Git branch and PR receives a live, production-like URL that everyone on your team can visit.


By using the OS’s native web renderer, the size of a Tauri app can be less than 600KB. Relicensing and redistribution is possible thanks to MIT or MIT/Apache 2.0 licensing where applicable. Hyperapp claims to be twice as fast as React, weighs in at 1.8KB, and renders interactively in ~10ms.

rust for FrontEnd Development

You will likely have to roll your own components such as date pickers. I find it relatively hard to get started with Tauri – even though it’s extensive documentation – that interests itself with a “transpiled” framework. Now I know with Vite I can develop my front-end whichever framework as my heart please and then add Tauri to it. Components are reusable pieces of functionality or design.

The SvelteKit CLI is accessed through the svelte-kit binary name. Writing yarn svelte-kit build, for example, tells yarn to fetch its local svelte-kit binary, which was installed via a devDependency, and then tells SvelteKit to run its build command. This guide is being tentatively hosted

Connecting To Redis

After the initial load, everything about the app is handled with JavaScript. This is, in theory, supposed to result in web apps that feel as fast and snappy as native apps. People looking for the practical Rust/WebAssembly/TS development guide. Function, which is effectively console.log for Rust, that the greet command used. It appears in the terminal’s console window — not the browser console — because this code still runs on the Rust/system side of things. The Tauri application compiles and is aware of the fact that it owns a “greet” command.

rust for FrontEnd Development

This means less time writing boilerplate and less time installing dependencies. Compile the code to WebAssembly, prepare JS/TS frontend and finish the course by creating the practical Snake game that can run in any browser. Very well written and very informative article, thanks for that! Especially for seasoned JS but novice Rust developer . This is also to say that using Tauri was not a challenge — it was a massive relief. I definitely plan to use Tauri again in the future, especially knowing that I can use just the webviewer if I want to.

Desktop Bundler

Our built-in CI/CD system triggers for every code change. Reliable live-editing experience for your UI components. There are a number of bindings available today to existing frameworks, but those looking for a mature, easy to use, and completely Rust-based solution will most likely find themselves out of luck. Let’s push those servers to the edge while we’re at it.

Instead of including a Node.js runtime, Tauri applications are built with Rust, a low-level systems language. This is how Tauri itself interacts with the operating system and “borrows” its native webviewer. All of the Tauri toolkit is compiled , which allows the built application to remain small and efficient.

However, this also means that we, the application developers, can include any additional crates — the “npm module” equivalent — into the built application. And, of course, there’s an aptly named redis crate that, as a Redis client driver, allows the Workers KV GUI to connect to any Redis instance. Also, as web developers, we expect to bring all our tooling with us. Again, this phase of the project is no different than your typical web application development cycle. You can expect to run yarn dev as your main command and feel at home. Keeping with an “easy” theme, I’ve elected to use SvelteKit, which is Svelte’s official framework and toolkit for building applications.

  • This means less time writing boilerplate and less time installing dependencies.
  • And finally, Services are auxiliary utilities to wrap low-level features or external services such as an HTTP client, Storage…
  • Vercel is the best place to deploy any frontend app.
  • Each news entry can either be a post contributed to the repo or a link back to your blog, Reddit thread, etc.
  • And, of course, SvelteKit certainly made this timeline possible.

Optimizing for cost and network load, we decided that a key’s value should only be fetched on command. This introduces a REFRESH button that, when clicked, interacts with the REST API once again, then dispatches a command so that the Redis client can update that key individually. Saving all the data into some kind of in-browser storage is totally viable, but it saves it locally to your machine. This means that if you have team members trying to do the same thing, everyone will have to fetch and save all the data on their own machines, too. Ideally, this Workers KV application should have the option to connect to and sync with an external database. That way, when working in team settings, everyone can tune into the same data cache to save time — and a couple bucks.

Scale dynamically to millions of pages without breaking a sweat. If you’re working on or writing about GUIs in Rust, please contribute! Each news entry can either be a post contributed to the repo or a link back to your blog, Reddit thread, etc.


It includes an optimized build system, a great developer experience (including HMR!), a filesystem-based router, and all that Svelte itself has to offer. The developer is responsible for webview contents and may optionally include custom Rust modules and/or define custom commands. Specifically, we’re interested in the invoke command, which takes a command name and a set of arguments. If there are any arguments, they must be defined as an object where the keys match the parameter names our Rust function expects. You see, part of Electron’s success is that, yes, it guarantees a web app is presented well on every operating system, but it also brings along a Node.js runtime. As a web developer, this was a lot like including a back-end API directly inside my client.

I’m tempted to call this the “easy part” but, given that you can use any and all HTML, CSS, and JavaScript frameworks, libraries, or patterns, choice paralysis can easily set in… which might be familiar, too. If you have a favorite front-end stack, great, use that! For this application, I chose to use Svelte because, for me, it certainly makes and keeps things easy. To build our components, we use the yew, crate which is, as I’m writing this, the most advanced and supported Rust frontend framework. Rust does not have a dominant framework at the level of Django or Rails. Most Rust frameworks are smaller and modular, similar to Flask or Sinatra.

Rust’s expressiveness and high level abstractions make it ideal for building intricate and complex user interfaces. Unfortunately, there is little consensus on what the best abstractions are. Ryan Carniato joins Jerod, Amelia, and Nick to discuss SolidjS – a declarative, efficient, and flexible JavaScript library Buttons or Dropdowns in FrontEnd Development for building user interfaces. At this time, I’m just designing my views and throwing around fake, hard-coded data until I have something that seems to work. I hung out here for about two days, until everything looked nice and all interactivity (button clicks, form submissions, etc.) got fleshed out.

So now it’s Thursday and I still haven’t written any Redis code, but at least I know how to connect the two halves of my application’s brain together. It was time to comb back through the client-side code and replace all TODOs inside event handlers and connect them to the real deal. However, that’s not exactly what I had in mind for my desktop application’s use case. The distDir relates to where the built production-ready assets are located. This value is resolved from the tauri.conf.json file location, hence the ../ prefix. Vercel combines the best developer experience with an obsessive focus on end-user performance.

A tour of a few libraries and frameworks to use that make application development generally easier . This means that you can take advantage of the amazing Rust ecosystem on the browser! Rust and WebAssembly integrate with existing Javascript tooling like NPM, Webpack, and ECMAScript modules!

Desktop Application Tooling

That’s the question Jonathan Creamer is here to answer. In so doing, we cover the past, present, and future of frontend tooling. You may prefer other Rust frameworks like MoonZoon or Yew. Heck, even Chris’s disclaimer of ‘when SPAs make sense’ section at the top is easily defeated by our Turbolinks implementation.


Rust does have a diverse package ecosystem, but you generally have to wire everything up yourself. Expect to put in a little bit of extra set up work to get started. If you are expecting everything bundled up for you, then Rust might not be for you just yet. Frontend development is not meant to be a solo activity.

Compartir esta publicacion

Deja una respuesta

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *