@@ -37,6 +37,57 @@ For static use cases, wRPC provides [WIT] binding generators for:
3737
3838wRPC fully supports the unreleased native [ WIT] ` stream ` and ` future ` data types along with all currently released WIT functionality.
3939
40+ ## Quickstart
41+
42+ Here is a guide demonstrating how to bootstrap the Wasm component based example implemented by
43+ [ examples/rust/hello-component-server] ( examples/rust/hello-component-server ) and
44+ [ examples/rust/hello-component-client] ( examples/rust/hello-component-client ) .
45+
46+ > There are 2 different kinds of examples
47+ > - Native wRPC applications, using a particular wRPC transport (currently, NATS only)
48+ > - Generic Wasm components, that run in a Wasm runtime
49+
50+ ### Generic Wasm components example
51+
52+ #### Requirement
53+ - ` docker ` >= 24.0.6 or ` nats-server ` >= 2.10.20
54+ - ` rust ` >= 1.80.1
55+
56+ #### How-To
57+ 1 . Add the ` wasm32-wasi ` target
58+ ``` bash
59+ rustup target add wasm32-wasip1
60+ ```
61+ 1. Build the server WASM component
62+ ` ` ` bash
63+ cargo build --release -p hello-component-server --target wasm32-wasip1
64+ ` ` `
65+ > Output is target/wasm32-wasi/release/hello_component_server.wasm.
66+ 1. Build the client WASM component
67+ ` ` ` bash
68+ cargo build --release -p hello-component-client --target wasm32-wasip1
69+ ` ` `
70+ > Output is target/wasm32-wasi/release/hello-component-client.wasm.
71+ 1. Run NATS service
72+ - Using docker
73+ ` ` ` bash
74+ docker run --rm -it --name nats-server -p 4222:4222 nats:2.10.20-alpine3.20
75+ ` ` `
76+ - Or run NATS server directly by following the instructions [here](https://docs.nats.io/running-a-nats-service/introduction/running)
77+ 1. Serve the server WASM component
78+ ` ` ` bash
79+ cargo run --release --bin wrpc-wasmtime-nats -- serve -g hello rust rust ./target/wasm32-wasip1/release/hello_component_server.wasm
80+ ` ` `
81+ 1. Call the server WASM component from the client WASM component
82+ ` ` ` bash
83+ cargo run --release --bin wrpc-wasmtime-nats -- run rust ./target/wasm32-wasip1/release/hello-component-client.wasm
84+ ` ` `
85+ Sample output in client side goes as
86+ ` ` ` bash
87+ INFO async_nats_wrpc: event: connected
88+ hello from Rust
89+ ` ` `
90+
4091# # Design
4192
4293# ## Transport
0 commit comments