Architecture
mik is a WASI HTTP runtime with JavaScript orchestration capabilities, packaged as a single CLI.
System Overview
Section titled “System Overview”Components
Section titled “Components”| Component | Technology | Purpose |
|---|---|---|
| HTTP Server | hyper 1.x | Async HTTP/1.1, graceful shutdown |
| WASM Runtime | wasmtime 40 | WASI Preview 2 execution |
| Script Runner | rquickjs | JavaScript orchestration |
| Cache | moka | LRU module caching |
| Circuit Breaker | custom | Failure isolation |
Request Flow
Section titled “Request Flow”WASM Handler
Section titled “WASM Handler”Script (Orchestration)
Section titled “Script (Orchestration)”Module Loading
Section titled “Module Loading”Circuit Breaker
Section titled “Circuit Breaker”Routing
Section titled “Routing”All handler routes use /run/<module>/* pattern:
| Route | Handler |
|---|---|
/run/auth/* | modules/auth.wasm |
/run/users/* | modules/users.wasm |
/script/checkout/* | scripts/checkout.js |
/health | Built-in health check |
/metrics | Prometheus metrics |
Project Structure
Section titled “Project Structure”mik/├── src/│ ├── commands/ # CLI commands (new, build, run, etc.)│ ├── runtime/ # WASM runtime, AOT cache│ ├── daemon/ # Background services (KV, SQL, etc.)│ └── manifest.rs # mik.toml parsing├── docs/ # Documentation (Astro)└── examples/ # Example projectsRelated Pages
Section titled “Related Pages”- Sidecar Communication - How handlers talk to infrastructure
- Security Model - Capability-based security
- Reliability Features - Circuit breakers, rate limiting