Using Seed for individual web assembly components?

I am exploring the idea of creating web assembly components that could be assembled to create a web page using javascript. For example, this forum could have separate web assembly components for the banner at the top, another component for the topics and another for creating a new topic. The javascript side would configure and orchestrate these components together. It seems like Seed could be used to build these components, but I can’t find a way to pass in initial configuration to Seed (e.g. pass on the element id to mount() in App::builder(). Questions:

  1. Any feedback on this idea in general?
  2. Is Seed a good fit for doing this? If so, how can I pass in initial configuration? If not, is there another framework that would be more suitable?


  1. Any feedback on this idea in general?

  2. Seed a good fit for doing this? If so, how can I pass in initial configuration? If not, is there another framework that would be more suitable?

    • You are not limited like, for instance, in Elm world - you can call JS functions directly. So it’s possible to get your initial data from JS where needed - e.g. in after_mount before you create a Model. There isn’t something like Elm flags at the moment.

    • But I don’t know if I recommend to use Seed for your use-case. If you want to write this project now I would rather choose WebComponents (Typescript + lit-element) and maybe Seed or some other lightweight framework for “orchestration” and things like routing.

    • Next step would be writing WebComponents in Rust - it should be possible pretty soon and I want to add first-class support for them in Seed in the future.

    • Once we are able to split WASM files into modules/plugins and communicate among modules without JS I want to add support for lazy loading to Seed.

    • If you want to write something like standalone WASM components based on something like Actor model with a lightweight orchestratior, I would look at WebComponents frameworks (maybe e.g. (?)) for inspiration or look at Yew - there were some experiments with Actors.

    • So as usual - it depends on your goals and requirements. WASM is still pretty new and you have to invent / fix / wait on many features, so be prepared. Seed is pretty stable even if it’s based on WASM because Rust teams are focused to make SPAs writing possible with their tools but with more “exotic” architecture you are on your own.

Wow, thank you for writing this very informative post! This is not an immediate project but more a future/vision thing that I am contemplating. The value of a self contained web assembly component is really clear, but how we orchestrate/connect these components is not. Perhaps an ELM like orchestration layer that can communicate with individual web assembly components. I am not convinced about web components quite yet, the idea is interesting but it feels too clunky.

If you feel adventurous, I’ve created a starting point for you:

  • You can see changes in the linked commit above.
  • You can clone the branch (that contains that commit) and init the project in the same way like you would do with the standard quickstart with webpack (i.e. with master branch; see Readme).
  • Run yarn start to build, serve and watch the app and the counter component.
  • There are minimum TS used as a glue between the app and counter components.
  • It’s just PoC, it’s error-prone and not scalable, but it should be simple enough to get you going.