Skip to content

Commit 36da1c5

Browse files
authored
Merge branch 'main' into copilot/add-installation-page-to-docs
Signed-off-by: Jiaxiao Zhou <[email protected]>
2 parents 8d0f30f + 5eb5b90 commit 36da1c5

File tree

7 files changed

+1642
-0
lines changed

7 files changed

+1642
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
77
### Added
88

99
- Comprehensive installation guide page consolidating all installation methods (one-liner script, Homebrew, Nix, WinGet) organized by platform (Linux, macOS, Windows) with verification steps and troubleshooting sections
10+
- Cookbook section in documentation with language-specific guides for building Wasm components in JavaScript/TypeScript, Python, Rust, and Go ([#328](https://github.com/microsoft/wassette/pull/328))
1011
- Multi-version documentation support with version dropdown, hosting at `/wassette/latest/` (main) and `/wassette/vX.Y/` (tags)
1112
- Automated release preparation and package manifest update workflows to eliminate manual version bump PRs ([#320](https://github.com/microsoft/wassette/pull/320))
1213

docs/SUMMARY.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@
55
- [MCP Clients](./mcp-clients.md)
66
- [FAQ](./faq.md)
77

8+
# Cookbook
9+
10+
- [Building Wasm Components](./cookbook/README.md)
11+
- [JavaScript/TypeScript](./cookbook/javascript.md)
12+
- [Python](./cookbook/python.md)
13+
- [Rust](./cookbook/rust.md)
14+
- [Go](./cookbook/go.md)
15+
816
# Reference
917

1018
- [CLI](./reference/cli.md)

docs/cookbook/README.md

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
# Cookbook: Building Wasm Components for Wassette
2+
3+
Welcome to the Wassette Cookbook! This section provides practical guides and recipes for building WebAssembly (Wasm) components that work with Wassette from various programming languages.
4+
5+
## What You'll Learn
6+
7+
The cookbook guides will walk you through:
8+
9+
- Setting up your development environment for each language
10+
- Understanding WebAssembly Interface Types (WIT)
11+
- Creating component interfaces
12+
- Implementing component logic
13+
- Building and testing your components
14+
- Best practices and common patterns
15+
16+
## Available Language Guides
17+
18+
Choose the programming language you want to use to build your Wasm component:
19+
20+
### [JavaScript/TypeScript](./javascript.md)
21+
Build Wasm components using JavaScript or TypeScript with the Bytecode Alliance's `jco` tooling. Perfect for developers familiar with Node.js ecosystem.
22+
23+
**Key highlights:**
24+
- Use familiar JavaScript/TypeScript syntax
25+
- Leverage npm packages and existing JavaScript libraries
26+
- Quick build times with `jco componentize`
27+
- Examples: time server, weather API, data processing
28+
29+
### [Python](./python.md)
30+
Create Wasm components using Python with `componentize-py`. Ideal for data processing, scripting, and AI/ML workflows.
31+
32+
**Key highlights:**
33+
- Write components in pure Python
34+
- Use the `uv` package manager for fast builds
35+
- Access Python's rich ecosystem
36+
- Examples: calculator, code execution, data analysis
37+
38+
### [Rust](./rust.md)
39+
Build high-performance Wasm components with Rust. Best for performance-critical tools and system-level programming.
40+
41+
**Key highlights:**
42+
- Near-native performance
43+
- Strong type safety and memory safety
44+
- Extensive WebAssembly tooling support
45+
- Examples: file system operations, HTTP clients
46+
47+
### [Go](./go.md)
48+
Develop Wasm components using Go and TinyGo. Great for developers who prefer Go's simplicity and concurrency features.
49+
50+
**Key highlights:**
51+
- Familiar Go syntax and idioms
52+
- Good performance characteristics
53+
- Growing WebAssembly support
54+
- Examples: module information service
55+
56+
## Getting Started
57+
58+
If you're new to WebAssembly components, we recommend:
59+
60+
1. **Start with the language you know best** - Each guide is self-contained and provides all the necessary context
61+
2. **Review the [Architecture documentation](../design/architecture.md)** - Understand how Wassette works with Wasm components
62+
3. **Check out the [Examples](https://github.com/microsoft/wassette/tree/main/examples)** - See working implementations in action
63+
4. **Read the [FAQ](../faq.md)** - Find answers to common questions
64+
65+
## Prerequisites
66+
67+
All guides assume basic familiarity with:
68+
69+
- Command-line tools and terminals
70+
- Your chosen programming language
71+
- Basic WebAssembly concepts (though we explain them in each guide)
72+
73+
## Common Concepts Across All Languages
74+
75+
Regardless of which language you choose, you'll work with:
76+
77+
### WIT (WebAssembly Interface Types)
78+
WIT is an Interface Definition Language (IDL) that defines how your component interacts with Wassette and other systems. All guides show you how to write WIT interfaces.
79+
80+
Example WIT interface:
81+
```wit
82+
package local:my-tool;
83+
84+
world my-component {
85+
export process: func(input: string) -> result<string, string>;
86+
}
87+
```
88+
89+
### Component Model
90+
The WebAssembly Component Model provides a standard way to create portable, composable, and secure modules. Your components will follow this model regardless of the source language.
91+
92+
### WASI (WebAssembly System Interface)
93+
WASI provides a standard interface for WebAssembly components to access system capabilities like file I/O, networking, and random number generation. Each guide explains which WASI features are available.
94+
95+
## Testing Your Components
96+
97+
Once you've built a component, you can test it with Wassette:
98+
99+
```bash
100+
# Load and test your component
101+
wassette serve --sse --plugin-dir /path/to/your/component
102+
103+
# Or load it explicitly
104+
wassette load file:///path/to/your/component.wasm
105+
```
106+
107+
For more details on testing, see the individual language guides.
108+
109+
## Contributing Your Components
110+
111+
Have you built a useful component? Consider contributing it to the [Wassette examples](https://github.com/microsoft/wassette/tree/main/examples)! See our [Contributing Guide](https://github.com/microsoft/wassette/blob/main/CONTRIBUTING.md) for details.
112+
113+
## Next Steps
114+
115+
Pick a language guide above and start building your first Wasm component! Each guide provides step-by-step instructions with working examples.
116+
117+
## Additional Resources
118+
119+
- [WebAssembly Component Model](https://component-model.bytecodealliance.org/)
120+
- [WIT Specification](https://github.com/WebAssembly/component-model/blob/main/design/mvp/WIT.md)
121+
- [WASI Preview 2](https://github.com/WebAssembly/WASI/blob/main/legacy/preview2/README.md)
122+
- [Model Context Protocol (MCP)](https://github.com/modelcontextprotocol/specification)

0 commit comments

Comments
 (0)