Skip to content

Examples Overview

cmd-ipc ships example projects for both language implementations. Each example is a complete, runnable application under ts/examples/ or rust/examples/ in the repository.

ExampleLanguageTransportShows
Web WorkersTypeScriptMessagePortChannelOffload computation to background threads, React + Vite
ElectronTypeScriptMessagePortChannelMain ↔ renderer IPC with shared schemas
Cloudflare WorkersTypeScriptHTTPChannelEdge-deployed HTTP commands with remote schema generation
AI Agent MCPTypeScriptMCPClient/ServerExpose commands as AI agent tools
Multi-ServiceRustInMemoryChannelCross-registry routing, #[command_service] macro, event fan-out

Web Workers

Offload computation to background threads while keeping the UI responsive. Shows MessagePortChannel with React and Vite.

View Example →

Electron

Type-safe IPC between main and renderer processes in desktop apps. Demonstrates shared schemas across processes.

View Example →

Cloudflare Workers

HTTP-based commands with remote schema generation. Shows HTTPChannel for edge computing.

View Example →

AI Agent MCP

Expose commands as AI agent tools via tool calling. Easily integrate with Vercel AI SDK, OpenAI, Anthropic, and other frameworks.

View Example →

Multi-Service

Two registries (root and worker) wired through an in-memory channel with a REPL on the root. Demonstrates the #[command_service] macro, cross-registry routing, and event fan-out.

View Example →