← Back to blog

Installable WASI 0.3 Pet Store example

Originally published on Medium.

New ghr logo by Talia Blasquez.

I published a petstore-serve.wasm and a petstore-test.wasm — WASI 0.3 examples that install with a single ghr command:

ghr install cataggar/wabt/petstore-serve@petstore-0.1.0
ghr install cataggar/wabt/petstore-test@petstore-0.1.0

petstore-serve starts a web service, and petstore-test makes a series of HTTP calls to exercise its endpoints. Internally, the web service is composed of two WebAssembly components: a web component and a storage component. The storage component implements a store interface that the web component consumes — for this example, an in-memory storage implementation was used.

I implemented the service in Zig, but the implementation details deserve their own post. There are several ways to build on this example — you could write a different implementation of the store interface, in Zig or in any other language with WebAssembly component-model support, and swap it in without touching the web component at all.

Current release: github.com/cataggar/wabt/releases/tag/petstore-0.1.0
Example source: github.com/cataggar/wabt/tree/example/petstore