Chakra

Chakra is a powerful WebAssembly (WASM) runtime CLI tool with full WASI support and modular plugin architecture.
✨ Features
- 🚀 Instant Development Server - Point Chakra to your .wasm file or project and get a ready playground in your browser
- 🌐 Browser Integration - Automatically opens your default browser with interactive console and debugging tools
- 💻 Interactive Console - View execution results and logs in a beautiful web interface
- 🔍 Smart Detection - Automatically identifies entry points and module types (standard WASM vs wasm-bindgen)
- 🔌 Plugin Architecture - Modular language support through a flexible plugin system
- 📦 Multi-Language Support - Built-in plugins for Rust, Go, C/C++, AssemblyScript, and Python
- 🔧 Built-in Compilation - Integrated build system with plugin-based compilation
- 🔍 WASM Inspection - Verify and analyze WASM files with detailed module information and binary analysis
- 👀 Live Reload - Watch mode for automatic recompilation and browser refresh during development
- 🌟 Full WASI Support - Complete WebAssembly System Interface implementation with virtual filesystem
- 🌐 Web Application Support - Experimental support for Rust web frameworks (Yew, Leptos, Dioxus, etc.)
- ⚡ Zero Configuration - Works out of the box with sensible defaults and automatic project detection
🚀 Installation
From Cargo (Recommended)
From Source
📖 Usage
Chakra supports both flag-based arguments using --path and direct positional arguments for an intuitive command line experience.
Quick Start
# Run on current directory
# Run a WebAssembly file directly
# Run a project directory
# With flags
🔧 Commands
Development Server
Start the development server with live reload:
Compilation
Compile a project to WebAssembly using the appropriate plugin:
Plugin Management
List available plugins and check dependencies:
# List all available plugins
# Get detailed plugin information
Verification & Inspection
Verify a WASM file format and analyze structure:
Project Management
Initialize a new project:
Clean build artifacts:
Server Control
Stop any running Chakra server:
🔌 Plugin Architecture
Chakra uses a modular plugin system where each programming language is supported through dedicated plugins. This architecture provides:
- Extensibility - Easy to add new language support
- Maintainability - Each plugin is self-contained
- Consistency - Unified interface across all languages
- Flexibility - Plugin-specific optimizations and features
Built-in Plugins
| Plugin | Status | Compiler/Runtime | Capabilities |
|---|---|---|---|
| ✅ Full Support | cargo + rustc |
Standard WASM, wasm-bindgen, web apps, optimization | |
| ✅ Full Support | tinygo |
Lightweight runtime, optimization | |
| ✅ Full Support | emscripten |
Complete toolchain, Makefile support | |
| ✅ Full Support | asc + npm/yarn |
TypeScript-like syntax, optimization | |
| ✅ Beta Support | py2wasm |
Runtime integration, bundle creation |
Plugin Capabilities
Each plugin provides specific capabilities:
| Feature | Rust | Go | C/C++ | AssemblyScript | Python |
|---|---|---|---|---|---|
| Compile to WASM | ✅ | ✅ | ✅ | ✅ | ✅ |
| Web Applications | ✅ | ❌ | ✅ | ❌ | ✅ |
| Live Reload | ✅ | ✅ | ✅ | ✅ | ❌ |
| Optimization | ✅ | ✅ | ✅ | ✅ | ❌ |
| Custom Targets | Multiple | wasm | web | wasm | TBD |
Web Frameworks (Rust Plugin)
The Rust plugin automatically detects and supports web frameworks with specialized web application mode:
- Yew - Modern Rust / Wasm framework
- Leptos - Full-stack, compile-time optimal Rust framework
- Dioxus - Cross-platform GUI library
- Sycamore - Reactive library
- Trunk - Build tool for Rust-generated WebAssembly
Web framework support is highly experimental and actively being improved. Looking for contributors. 👋
🌟 How It Works
Plugin-Based Compilation
- Project Detection - Chakra analyzes the project and selects the appropriate plugin
- Dependency Verification - The plugin checks for required tools and dependencies
- Compilation - Plugin-specific build process with optimizations
- Output Generation - WASM file creation with plugin-specific features
For WASM Files
- Chakra server with WASI support starts running
- Opens your default browser with an interactive interface
- Serves the WASM file with comprehensive WASI support including virtual filesystem
- Provides real-time console output, debugging tools, and file system interaction
For Projects
- Plugin Selection - Automatically identifies and loads the appropriate language plugin
- Dependency Checking - Plugin verifies required tools are installed
- Compilation - Plugin builds optimized WASM with proper flags and optimizations
- Serving - Runs development server with live reload
- Framework Detection - Special handling for web applications (Rust plugin)
🔍 WASI Support
Chakra intends to provide support for complete WebAssembly System Interface (WASI) implementation in the browser. It's a work in progress. Some features might work, but it's highly experimental.
🎯 Use Cases
Development & Testing
# Quick WASM testing with instant feedback
# Project development with live reload (plugin auto-detected)
# Build and optimize for production (plugin-specific optimizations)
Plugin Management
# List available plugins and their capabilities
# Get detailed information about a specific plugin
Learning & Education
# Inspect WASM structure and understand internals
# Verify WASM compliance and format
# See which plugin would handle a project
Web Application Development
# Rust web app with hot reload (Rust plugin auto-detects frameworks)
# Multi-framework support
# Python web app with Pyodide
Performance Analysis
# Size-optimized builds with plugin-specific optimizations
# Debug builds with full symbols
# Compare different plugin optimizations
🔧 Configuration
Environment Variables
CHAKRA_PORT- Default server port (default: 8420)CHAKRA_WATCH- Enable watch mode by defaultCHAKRA_OUTPUT- Default output directory for buildsCHAKRA_DEBUG- Enable debug outputRUST_BACKTRACE- Show stack traces for errors
Plugin Detection
Chakra automatically selects plugins based on project structure:
- Rust Plugin:
Cargo.tomlpresent - Go Plugin:
go.modor.gofiles present - C/C++ Plugin:
.c,.cpp,.hfiles, orMakefilepresent - AssemblyScript Plugin:
package.jsonwith AssemblyScript dependency orassembly/directory - Python Plugin:
.pyfiles orrequirements.txtpresent
Optimization Levels
Plugin-specific optimization levels:
debug- Fast compilation, full symbols, no optimizationrelease- Optimized for performance (default)size- Optimized for minimal file size (plugin-dependent implementation)
🔍 Troubleshooting
Plugin-Related Issues
"No plugin found for project"
# Check what files are in your project
# Ensure proper entry files exist (Cargo.toml, go.mod, etc.)
# Use chakra plugins list to see available plugins
🚨 Open an issue and let us know about it.
"Plugin dependencies missing"
# Install missing tools for specific plugins:
# Install emcc for C/C++ plugin
# Install tinygo for Go plugin
# Install asc for AssemblyScript plugin
"Wrong plugin selected"
# Force a specific plugin
Configuring py2wasm
- Make sure that you have python3.11.0 is installed and configured. We recommend
using mise.
- Now install py2wasm, you can use a virtual environment or not.
- Make sure that you have named the entry file as main.py or app.py.
Common Issues
"Port is already in use"
"No entry point found"
- Ensure your WASM has
main(),_start(), or exported functions - Use
chakra inspectto see available exports - Check plugin-specific entry file requirements
"wasm-bindgen module detected"
- Use the
.jsfile instead of the.wasmfile directly (Rust plugin) - Run
chakra project-dirinstead of individual files
🤝 Contributing
We welcome contributions! Please see CONTRIBUTING.md for detailed guidelines, including how to add new plugins and extend existing ones.
Adding New Plugins
The modular architecture makes it easy to add support for new languages. See the plugin development guide for details.
📄 License
🙏 Credits
Chakra is built with love using:
- tiny_http - Lightweight HTTP server
- clap - Command line argument parsing
- notify - File system watching for live reload
- wasm-bindgen - Web integration
- And the amazing Rust and WebAssembly communities ❤️
Made with ❤️ for the WebAssembly community
⭐ If you find Chakra useful, please consider starring the repository!