Configuration
mik is configured via mik.toml in your project root.
Full Example
Section titled “Full Example”[project]name = "my-service"version = "0.1.0"description = "My WASI HTTP service"
[server]port = 3000modules = "modules/"scripts = "scripts/" # Optional: JS orchestrationstatic = "static/" # Optional: static filescache_size = 100http_allowed = ["api.example.com", "*.supabase.co"]
[composition]http_handler = true # Auto-downloads bridge from ghcr.io/dufeutech/mik-sdk-bridge
[dependencies]# OCI registry (ghcr.io is default)"dufeutech/router" = "latest""dufeutech/auth" = "v1.0.0"
# Local pathutils = { path = "../utils" }[project] Section
Section titled “[project] Section”| Field | Type | Default | Description |
|---|---|---|---|
name | string | required | Project name (used for WASM output) |
version | string | "0.1.0" | Semantic version |
description | string | - | Project description |
[server] Section
Section titled “[server] Section”| Field | Type | Default | Description |
|---|---|---|---|
port | number | 3000 | HTTP server port |
modules | string | "modules/" | WASM handlers directory |
scripts | string | - | JS/TS scripts directory (enables orchestration) |
static | string | - | Static files directory |
cache_size | number | 100 | Max cached modules |
http_allowed | array | [] | Allowed outgoing HTTP hosts |
shutdown_timeout_secs | number | 30 | Graceful shutdown drain timeout |
log_max_size_mb | number | 10 | Max log file size before rotation |
log_max_files | number | 5 | Max rotated log files to keep |
watch_debounce_ms | number | 300 | File watch debounce duration |
http_allowed Patterns
Section titled “http_allowed Patterns”# Disable outgoing HTTP (default)http_allowed = []
# Allow all hostshttp_allowed = ["*"]
# Specific hostshttp_allowed = ["api.example.com"]
# Wildcard subdomainshttp_allowed = ["*.supabase.co"]
# Multiple patternshttp_allowed = ["api.example.com", "*.supabase.co", "github.com"][composition] Section
Section titled “[composition] Section”| Field | Type | Default | Description |
|---|---|---|---|
http_handler | boolean | false | Auto-download and compose with HTTP bridge |
When http_handler = true, mik build -c automatically:
- Downloads the bridge from
ghcr.io/dufeutech/mik-sdk-bridge - Composes your handler with the bridge using WAC
[dependencies] Section
Section titled “[dependencies] Section”Dependencies are pulled from OCI registries (ghcr.io by default).
Simple Format (OCI)
Section titled “Simple Format (OCI)”[dependencies]# Format: "user/repo" = "version"# Resolves to: ghcr.io/user/repo:version
"dufeutech/router" = "latest""dufeutech/auth" = "v1.0.0""myorg/utils" = "v2.0"Extended Formats
Section titled “Extended Formats”[dependencies]# Custom registry (requires both registry AND version)db = { registry = "ghcr.io/myorg/database", version = "v1.0" }cache = { registry = "docker.io/myorg/cache", version = "latest" }
# Git repositoryrouter = { git = "https://github.com/user/repo.git" }router-branch = { git = "https://github.com/user/repo.git", branch = "main" }router-tag = { git = "https://github.com/user/repo.git", tag = "v1.0.0" }
# Local path (for development)local = { path = "../component.wasm" }utils = { path = "../my-utils" }Adding Dependencies
Section titled “Adding Dependencies”# Add from OCI (requires user/repo format)mik add dufeutech/routermik add dufeutech/router:v1.0.0
# Add from gitmik add mylib --git "https://github.com/user/repo.git"
# Add local pathmik add utils --path "../utils"Runtime Configuration
Section titled “Runtime Configuration”Advanced runtime settings for mik run:
[server]# Request limitsexecution_timeout_secs = 30 # Max handler execution timemax_concurrent_requests = 1000 # Global request limitmax_per_module_requests = 10 # Per-handler limitmax_body_size_mb = 10 # Max request body size
# Cache settingscache_size = 100 # Max cached modulesmax_cache_mb = 256 # Cache memory limit
# Lifecycle settingsshutdown_timeout_secs = 30 # Graceful shutdown drain timelog_max_size_mb = 10 # Log rotation sizelog_max_files = 5 # Max log files to keepwatch_debounce_ms = 300 # File watcher debounce[tracing] Section
Section titled “[tracing] Section”OpenTelemetry tracing configuration:
[tracing]service_name = "my-service"otlp_endpoint = "http://localhost:4317" # Jaeger, Tempo, etc.Environment Variables
Section titled “Environment Variables”Override settings via environment:
# Override portPORT=8080 mik run
# Override bind address (for Docker)HOST=0.0.0.0 mik run
# Enable debug loggingRUST_LOG=debug mik run
# Enable hot reload modeMIK_HOT_RELOAD=1 mik runExample Configurations
Section titled “Example Configurations”Minimal
Section titled “Minimal”[project]name = "api"version = "0.1.0"
[server]port = 3000
[composition]http_handler = trueWith Dependencies
Section titled “With Dependencies”[project]name = "api"version = "0.1.0"
[server]port = 3000modules = "modules/"
[composition]http_handler = true
[dependencies]"dufeutech/router" = "latest""dufeutech/auth" = "v1.0.0"Full Production
Section titled “Full Production”[project]name = "production-api"version = "1.0.0"description = "Production API service"
[server]port = 8080modules = "modules/"scripts = "scripts/"static = "public/"cache_size = 100max_cache_mb = 512execution_timeout_secs = 30max_concurrent_requests = 2000max_per_module_requests = 50shutdown_timeout_secs = 60log_max_size_mb = 50log_max_files = 10http_allowed = ["*.internal.example.com"]
[composition]http_handler = true
[tracing]service_name = "production-api"otlp_endpoint = "http://tempo:4317"
[dependencies]"myorg/router" = "v2.0.0""myorg/auth" = "v1.5.0"utils = { path = "../shared-utils" }