This repository contains sample code demonstrating WebAssembly (Wasm) Component Composition using CNCF Spin and the Wasm Component Model....
For step-by-step guidance, detailed code walkthroughs, and conceptual explanations, check out the official blog post:
👉 Read the full guide on my blog
spinCLI (version4.0.2or newer)- Rust toolchain (with
wasm32-wasip2target)
git clone git@github.com:ThorstenHans/component-composition-spin.git
cd component-composition-spinThe application manifest spin.toml is configured to compile all components. The application component and the classifier component. All you have to do is run spin build:
spin buildTo run the application on your host use spin up:
spin upUse curl and send several messages to the Spin application:
# an urgent message
curl -XPOST -d '{"message": "Buy milk ASAP"}' \
-H 'content-type:application/json' \
localhost:3000
# a relaxed message
curl -XPOST -d '{"message": "Someday we should buy milk"}' \
-H 'content-type:application/json' \
localhost:3000
# a neutral message
curl -XPOST -d '{"message": "Buy milk"}' \
-H 'content-type:application/json' \
localhost:3000