Skip to content

Leptos WASI Preview 2 integration, working with wasmcloud and possibly others

License

Notifications You must be signed in to change notification settings

leptos-rs/leptos_wasi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

leptos_wasi

Run your Leptos Server-Side in WebAssembly using WASI standards.

Explainer

WebAssembly is already popular in the browser but organisations like the Bytecode Alliance are committed to providing the industry with new standard-driven ways of running software. Specifically, they are maintaining the Wasmtime runtime, which allows running WebAssembly out of the browser (e.g., on a serverless platform).

Leptos is already leveraging WebAssembly in the browser and gives you tools to build web applications with best-in-class performance.

This crate aims to go further and enable you to also leverage WebAssembly for your Leptos Server. Specifically, it will allow you to target the rust wasm32-wasip2 target for the server-side while integrating seamlessly with the Leptos Framework.

Running cargo leptos build will provide you with a WebAssembly Component importing the wasi:http/proxy world. This means you can serve your server on any runtime supporting this world, for example:

wasmtime serve target/server/wasm32-wasip2/debug/your_crate.wasm -Scommon

Disclaimer

This crate is EXPERIMENTAL and the author is not affiliated with the Bytecode Alliance nor funded by any organisation. Consider this crate should become a community-driven project and be battle-tested to be deemed production-ready.

Contributions are welcome!

Usage

TODO: Write a template starter for the crate.

Compatibility

This crate only works with the future Leptos v0.7.

Features

  • 🐙 Async Runtime: This crate comes with a single-threaded async executor making full use of WASIp2 pollable, so your server is not blocking on I/O and can benefit from Leptos' streaming SSR Modes.
  • Short-circuiting Mechanism: Your component is smart enough to avoid preparing or doing any rendering work if the request routes to static files or Server Functions.
  • 🚚 Custom Static Assets Serving: You can write your own logic for serving static assets. For example, once wasi:blobstore matures up, you could host your static assets on your favorite Object Storage provider and make your server fetch them seamlessly.

About

Leptos WASI Preview 2 integration, working with wasmcloud and possibly others

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages