Chakra is a powerful WebAssembly (WASM) runtime CLI tool with full WASI support.
- π 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)
- π¦ Multi-Language Support - Compile Rust, Go, C/C++, and AssemblyScript projects to WASM
- π§ Built-in Compilation - Integrated build system
- π 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
cargo install chakra
git clone https://github.com/anistark/chakra.git
cd chakra
cargo install --path .
Chakra supports both flag-based arguments using --path
and direct positional arguments for an intuitive command line experience.
# Run on current directory
chakra
# Run a WebAssembly file directly
chakra myfile.wasm
# Run a project directory
chakra ./my-wasm-project
# With flags
chakra --path ./path/to/your/file.wasm
chakra --path ./my-wasm-project
Start the development server with live reload:
chakra run ./my-project --watch
chakra run ./my-project --port 3000 --language rust
Compile a project to WebAssembly:
chakra compile ./my-project
chakra compile ./my-project --output ./build --optimization release
chakra compile ./my-project --optimization size --verbose
Verify a WASM file format and analyze structure:
chakra verify ./file.wasm
chakra verify ./file.wasm --detailed
chakra inspect ./file.wasm
Initialize a new project:
chakra init my-app --template rust
chakra init my-app --template go --directory ./projects/
Clean build artifacts:
chakra clean ./my-project
Stop any running Chakra server:
chakra stop
Chakra automatically detects and supports Rust 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. π
- 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
- Language Detection - Automatically identifies project type (Rust, Go, C, AssemblyScript)
- Dependency Checking - Verifies required tools are installed
- Compilation - Builds optimized WASM with proper flags and optimizations
- Serving - Runs development server with live reload
- Experimental Web App Mode - Special handling for web applications with framework detection
Chakra includes a complete WebAssembly System Interface (WASI) implementation in the browser:
- Virtual Filesystem - Complete file system with directories, file creation, and manipulation
- Standard I/O - stdout, stderr with console integration and real-time display
- Environment Variables - Full environment variable support
- Command Arguments - Access to command-line arguments
- File Operations - Read, write, seek, and comprehensive file management
- Random Number Generation - Secure random numbers via Web Crypto API
- Time Functions - System time and high-precision timers
- Pre-opened Directories - Filesystem sandboxing and security
- Interactive Console - Real-time output and error display
- File Explorer - Browse and edit virtual filesystem contents
- Network Sockets - TCP/UDP socket support for networking
- Threading - Multi-threading and shared memory support
- Advanced I/O - Async I/O operations and streaming
# Quick WASM testing with instant feedback
chakra test.wasm
# Project development with live reload
chakra run ./my-rust-project --watch
# Build and optimize for production
chakra compile ./my-project --optimization size
# Inspect WASM structure and understand internals
chakra inspect ./complex-module.wasm
# Verify WASM compliance and format
chakra verify ./student-submission.wasm --detailed
# Rust web app with hot reload
chakra run ./my-yew-app --watch
# Multi-framework support
chakra run ./leptos-project
chakra run ./dioxus-app
# Size-optimized builds
chakra compile ./my-project --optimization size
# Debug builds with full symbols
chakra compile ./my-project --optimization debug --verbose
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
Chakra automatically detects project types based on files:
- Rust:
Cargo.toml
present - Go:
go.mod
or.go
files present - C/C++:
.c
,.cpp
, or.h
files present - AssemblyScript:
package.json
with AssemblyScript dependency - Python: π§ Coming Soon
debug
- Fast compilation, full symbols, no optimizationrelease
- Optimized for performance (default)size
- Optimized for minimal file size
# Standard Rust WASM
cargo new --bin my-wasm-app
cd my-wasm-app
# Add your Rust code
chakra run .
# Rust web application with live reload
cargo new --bin my-web-app
cd my-web-app
# Add Yew/Leptos dependencies to Cargo.toml
chakra run . --watch
# Simple C program
echo 'int main() { printf("Hello WASI!"); return 42; }' > hello.c
emcc hello.c -o hello.wasm
chakra hello.wasm
# TinyGo project
echo 'package main
import "fmt"
func main() { fmt.Println("Hello from TinyGo!") }' > main.go
chakra run .
"Port is already in use"
chakra stop # Stop existing server
chakra --port 3001 # Use different port
"No entry point found"
- Ensure your WASM has
main()
,_start()
, or exported functions - Use
chakra inspect
to see available exports
"Missing compilation tools"
# Install required compilers
rustup target add wasm32-unknown-unknown # For Rust
# Install emcc for C/C++
# Install tinygo for Go
chakra compile --help # See tool requirements
"wasm-bindgen module detected"
- Use the
.js
file instead of the.wasm
file directly - Run
chakra project-dir
instead of individual files
We welcome contributions! Please see CONTRIBUTING.md for detailed guidelines.
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!