A comprehensive guide to building WebAssembly from multiple programming languages. This book is designed for advanced developers who want to master WASM across web, server, embedded, and edge computing contexts.
This book assumes you already know the programming languages we'll be using. Our focus is on teaching you WebAssembly itself—how to compile to it, optimize for it, and deploy it effectively across different environments.
Status: Complete - All 52 chapters written, covering foundations through advanced topics to real-world practice projects.
- Introduction - Why WASM exists, use cases, and the problems it solves
- Architecture - Stack machine model, instruction set architecture, specification overview
- Text Format - Deep dive into WAT (WebAssembly Text format) syntax
- Binary Format - Understanding WASM bytecode structure and encoding
- Type System - Value types, function signatures, and type validation
- Memory Model - Linear memory, pages, limits, and memory operations
- Module Anatomy - Module sections, structure, and validation rules
- Instantiation - Module loading, compilation, and linking process
- Imports and Exports - Interface patterns and module composition
- Tables - Indirect calls, function references, and dynamic dispatch
- Security Model - Sandboxing, capability-based security, and isolation
- Compilers Overview - Landscape of WASM compilation targets
- Runtimes - wasmtime, wasmer, wasm3, and browser engines
- WASI - WebAssembly System Interface specification
- Debugging - Tools, source maps, profiling, and troubleshooting
- Testing - Unit testing WASM modules and integration testing strategies
- Rust Fundamentals - Using rustc with wasm32 target, basics
- Rust Advanced - wasm-bindgen, wasm-pack, and optimization techniques
- Go Official - Go's official WASM support and its limitations
- TinyGo - Better Go WASM compilation and tradeoffs
- C/C++ - Emscripten ecosystem and toolchain
- Clang WASM - Direct LLVM-based compilation without Emscripten
- AssemblyScript - TypeScript-like language designed for WASM
- .NET and Blazor - C# and the .NET approach to WebAssembly
- Zig - Modern systems language with excellent WASM support
- Swift - SwiftWasm project and Swift's WASM capabilities
- Kotlin - Kotlin/Wasm and the JVM ecosystem approach
- Python - Pyodide, limitations, and Python in the browser
- Experimental Languages - Grain, Moonbit, and emerging WASM-first languages
- Barely There - Languages with minimal or experimental WASM support
- Browser APIs - The WebAssembly JavaScript API
- JavaScript Interop - Calling conventions and data marshalling
- DOM Access - Patterns for DOM manipulation from WASM
- Web Workers - Threading and parallel execution in browsers
- Streaming - Streaming compilation and instantiation
- WASI Deep Dive - Filesystem, networking, and system interfaces
- CLI Tools - Building command-line tools with WASM
- Server-Side - Fastly Compute, Cloudflare Workers, and server runtimes
- Plugin Systems - Extending applications with WASM plugins
- Embedded Runtimes - wasm3, WAMR for IoT and microcontrollers
- Edge Computing - CDN edge, distributed computing patterns
- Resource Constraints - Optimizing for memory and CPU-constrained targets
- SIMD - Vector instructions and parallel data processing with v128 types
- Threads - Shared memory threading model and atomics
- Component Model - Next-generation composition with WIT interfaces
- Garbage Collection - GC proposal for managed languages (Java, Kotlin, Dart)
- Exception Handling - First-class exceptions with try/catch/throw
- Tail Calls - Tail call optimization for functional programming patterns
- Building an Image Processor - Complete image processing app with SIMD and Web Workers
- Building a Game Engine - 2D platformer with ECS architecture
- Cryptography and Data Processing - SHA-256, PBKDF2, AES-256 implementation
- Real-Time Audio Synthesis - Polyphonic synthesizer with AudioWorklet
- Glossary - WASM terminology reference
- Contributing - Guidelines for contributing to this book
See LICENSE for details.
- Sequential reading: Parts 1-3 build foundational knowledge. Read these in order.
- Language chapters: Pick the languages relevant to your work (Parts 4-5).
- Context-based reading: Choose Part 6 (Web), Part 7 (Server), or Part 8 (Embedded) based on your deployment target.
- Advanced readers: Parts 9-10 can be read independently once you understand the foundations.
This book assumes:
- Strong programming background in at least one systems or application language
- Familiarity with concepts like memory management, types, and compilation
- Basic understanding of how code executes on hardware
- No prior WASM knowledge required