Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Wasm Component Composition with Spin 4.0

This repository contains sample code demonstrating WebAssembly (Wasm) Component Composition using CNCF Spin and the Wasm Component Model....

📖 Full Guide & Tutorial

For step-by-step guidance, detailed code walkthroughs, and conceptual explanations, check out the official blog post:

👉 Read the full guide on my blog


🚀 Getting Started

Prerequisites

  • spin CLI (version 4.0.2 or newer)
  • Rust toolchain (with wasm32-wasip2 target)

Quickstart

Clone the repository

git clone git@github.com:ThorstenHans/component-composition-spin.git
cd component-composition-spin

Build All Components

The 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 build

Run The Application Locally

To run the application on your host use spin up:

spin up

Test The App

Use 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

Releases

Packages

Contributors

Languages