How to build an extensible rust desktop app with hot-reloadable UI-modifying plugins?

I’m designing a rust desktop application that is meant to be extended by third-party developers via plugins.

A hard requirement is that plugins can be hot reloaded both during development and while the app is running, without restarting the main application.

It it aimed to be something like VSCode/Obsidian etc. where users will be able to add UI elements as well.

What are my options.

Never worked with it, but https://extism.org/ interests me in these regards. Using WebAssembly—allowing users to write their plugin in their WASM-compiling language of choice—for plugins seems a very sensible thing to do to me. Typst uses a similar approach for plugins.

1 Like

Is there any other alternatives?

I know zed also uses WebAssembly. Is there any cons of using this approach.

Haven't used it myself, but Stabby — C interface for Rust // Lib.rs is an option. Downside is reloading native shared libraries doesn't work fully on all platforms (especially not if using TLS[1] variables (which e.g. Tokio does internally). You also won't get any sandboxing of course, but performance will potentially be better.

Yet another option is to embed some scripting language such as Lua, Rune, Rhai or JavaScript.

You have to decide what tradeoffs are worth it.


  1. Thread Local Storage ↩︎

1 Like

I shared the requirement with the community, although the feedback was negative. You may have a better luck.

1 Like