- think of WebAssembly as a compile target; a standardized bytecode formart to execute programs
AssemblyScript, Grain like languages have been designed specifically for compilation to WASM; using binaryen
JS-in-WASM allows sandboxing one Javascript program from another
WASI (WebAssembly System Interface) is WIP to provide features like filesystem, db, network connection while upholding reliability
WAMR is a micro lightweight standalone runtime for WebAssembly; Wasmtime as well
- Spin is a framework for web apps, microservices & other server like applications. Rust & Go both have robust Spin support, can also use Python/Ruby/AssemblyScript/Grain/C/C++ and others.
Fermyon already runs Spin in Production using a WebAssembly based Bartholomew CMS, built as a Wagi app i.e. WebAssembly Gateway Interface
Hippo is an easy way to deploy & serve WebAssembly; for similar purpose there is a Kubernetes' Rust Kubelete Krustlet
-
Spin provides a framework to easily expose WASM features while creating FaaS style design
-
After Wagi, WASM has many updates to pave path for Spin. WASI & WIT (WASM Interface, an experimental textual format defining interfaces) make Spin easy to manage goals like Security
-
Samples in Rust & Go for a simple logic of
HTTP 200 Spin It!using common HTTP Request/Response model
#[http_component]
fn hello_world(_req: Request) -> Result<Response> {
Ok(Response::builder()
.status(200)
.body(Some("Spin It!".into()))?)
}func main() {
spin.HandleRequest(func(w http.ResponseWriter, r *http.Request) {
fmt.Fprintln(w, "Spin It!")
})
}low-level duties like setting up SSL, handling iterrupts or managing network connection gets delegate to Spin; you just
spin upto run
-
Currently (May/2022) it only supports top-level HTTP request/response for few languages. But it ships with 100% Wagi implementation, so almost all WASI supporting languages could be used.
-
spin_sdkprovides support for more components like Redis; more are in process of release -
Spin support for Bindle packaging, WebAssembly Component Model and WIT.
Spin FileServer shows a production-ready spin app