Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Oct 3, 2025

Overview

This PR adds a comprehensive cookbook section to the Wassette documentation that provides practical, hands-on guides for building WebAssembly components in different programming languages. The cookbook complements the existing detailed development guides by offering quick-start instructions and working examples for developers who want to get started quickly.

Motivation

While Wassette already has excellent in-depth development guides in docs/development/, new users need a more practical, quick-reference resource to get started building Wasm components. The cookbook section addresses this by providing:

  • Step-by-step tutorials with minimal explanation
  • Complete working code examples that can be copied and modified
  • Quick reference for common patterns
  • Clear navigation to comprehensive documentation for deeper learning

Changes

New Documentation Structure

Added a new docs/cookbook/ directory with the following files:

  • README.md (122 lines) - Cookbook overview that introduces the concept, explains what users will learn, and provides navigation to all language-specific guides
  • javascript.md (251 lines) - JavaScript/TypeScript guide using jco with examples including time server and weather API
  • python.md (348 lines) - Python guide using componentize-py with calculator and data processing examples
  • rust.md (415 lines) - Rust guide using wit-bindgen with HTTP client and file system examples
  • go.md (497 lines) - Go/TinyGo guide with module information service and text processing examples

Each Language Guide Includes

  • Prerequisites - Required tools and installation instructions
  • Quick Start - Minimal setup to get running fast
  • Step-by-Step Tutorial - Building a component from scratch
  • Complete Examples - Multiple working code examples with explanations
  • Error Handling - Patterns for WIT result types in each language
  • Best Practices - Security considerations, testing tips, and code quality guidance
  • Common Patterns - Practical code snippets for typical use cases (JSON processing, HTTP requests, file operations)
  • Troubleshooting - Solutions to common build and runtime errors
  • Links - References to comprehensive development guides and working examples in the repository

Documentation Navigation

Updated docs/SUMMARY.md to add the cookbook section to the mdBook navigation structure, positioned between the main documentation and the reference section for easy discoverability.

Security Considerations

Added explicit security warnings where appropriate:

  • Warning about eval() usage in Python examples with recommendations to use ast.literal_eval() or proper expression parsers
  • Best practices section in each guide emphasizing security

Documentation Philosophy

The cookbook follows a two-tier documentation approach:

  • Cookbook (NEW) → Practical, hands-on, quick reference for getting started
  • Development Guides → Comprehensive, detailed, in-depth documentation

Users can start with the cookbook for quick implementation, then refer to development guides in docs/development/ for deeper understanding. Each cookbook page links to its corresponding comprehensive guide.

Examples

Here's how the JavaScript cookbook helps users get started quickly:

# Install tools
npm install -g @bytecodealliance/jco

# Create project
mkdir my-component && cd my-component
npm init -y

# Define interface in wit/world.wit, implement in main.js, then build:
jco componentize main.js --wit ./wit -o component.wasm

Each guide follows similar patterns adapted to the language's tooling and idioms.

Testing

  • ✅ All internal documentation links verified (relative paths to ../development/, ../design/, etc.)
  • ✅ External links to GitHub examples and official documentation included
  • ✅ Consistent structure maintained across all language guides
  • ✅ Code examples reviewed for syntax correctness
  • ✅ Security review completed and addressed

Impact

This cookbook section significantly lowers the barrier to entry for developers building Wasm components for Wassette by:

  1. Providing clear, actionable steps for each supported language
  2. Offering working examples that can be immediately used
  3. Including best practices to avoid common pitfalls
  4. Giving security guidance for safe component development

Closes #[ISSUE_NUMBER]

Original prompt

This section details on the original issue you should resolve

<issue_title>Docs: Add a cookbook section in the docs to include how to build Wasm Components that work with wassette</issue_title>
<issue_description>The new cookbook section should detail the instructions on building wasm components from different languages.</issue_description>

Comments on the Issue (you are @copilot in this section)

Fixes #327

💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Copilot AI and others added 2 commits October 3, 2025 21:22
- Create new cookbook directory with comprehensive guides
- Add overview page introducing cookbook structure
- Add JavaScript/TypeScript cookbook guide with quick start and examples
- Add Python cookbook guide with step-by-step instructions
- Add Rust cookbook guide with build automation examples
- Add Go cookbook guide with TinyGo setup
- Update SUMMARY.md to include cookbook section in navigation
- Update CHANGELOG.md to document new feature

Co-authored-by: Mossaka <[email protected]>
Add clear warnings about eval() security risks and best practice to avoid it for untrusted input

Co-authored-by: Mossaka <[email protected]>
@Copilot Copilot AI changed the title [WIP] Add cookbook section for building Wasm components docs: Add cookbook section with language-specific guides for building Wasm components Oct 3, 2025
@Copilot Copilot AI requested a review from Mossaka October 3, 2025 21:34
Copilot finished work on behalf of Mossaka October 3, 2025 21:34
@Mossaka Mossaka marked this pull request as ready for review October 3, 2025 21:36
@Mossaka
Copy link
Collaborator

Mossaka commented Oct 3, 2025

@copilot use playwrite to display visual changes

Copy link
Contributor Author

Copilot AI commented Oct 3, 2025

@copilot use playwrite to display visual changes

I've used Playwright to build and capture the documentation showing the visual changes. Here are the screenshots:

1. Navigation with new Cookbook section:
Main Navigation

The Cookbook section now appears in the navigation with 4 language-specific guides (JavaScript/TypeScript, Python, Rust, and Go).

2. Cookbook Overview Page:
Cookbook Overview

The overview page introduces the cookbook concept and provides navigation to all language guides with key highlights for each.

3. JavaScript/TypeScript Guide:
JavaScript Guide

Quick start guide with step-by-step instructions, code examples, and practical patterns.

4. Python Guide:
Python Guide

Comprehensive Python guide with prerequisites, installation steps, and complete working examples.

All guides follow the same consistent structure and are fully rendered in the mdBook documentation.

Copilot finished work on behalf of Mossaka October 3, 2025 21:50
@Mossaka Mossaka merged commit 5eb5b90 into main Oct 3, 2025
9 checks passed
@Mossaka Mossaka deleted the copilot/add-cookbook-section-docs branch October 3, 2025 22:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Docs: Add a cookbook section in the docs to include how to build Wasm Components that work with wassette

2 participants