Skip to content

Configuration

mik is configured via mik.toml in your project root.

[project]
name = "my-service"
version = "0.1.0"
description = "My WASI HTTP service"
[server]
port = 3000
modules = "modules/"
scripts = "scripts/" # Optional: JS orchestration
static = "static/" # Optional: static files
cache_size = 100
http_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 path
utils = { path = "../utils" }
FieldTypeDefaultDescription
namestringrequiredProject name (used for WASM output)
versionstring"0.1.0"Semantic version
descriptionstring-Project description
FieldTypeDefaultDescription
portnumber3000HTTP server port
modulesstring"modules/"WASM handlers directory
scriptsstring-JS/TS scripts directory (enables orchestration)
staticstring-Static files directory
cache_sizenumber100Max cached modules
http_allowedarray[]Allowed outgoing HTTP hosts
shutdown_timeout_secsnumber30Graceful shutdown drain timeout
log_max_size_mbnumber10Max log file size before rotation
log_max_filesnumber5Max rotated log files to keep
watch_debounce_msnumber300File watch debounce duration
# Disable outgoing HTTP (default)
http_allowed = []
# Allow all hosts
http_allowed = ["*"]
# Specific hosts
http_allowed = ["api.example.com"]
# Wildcard subdomains
http_allowed = ["*.supabase.co"]
# Multiple patterns
http_allowed = ["api.example.com", "*.supabase.co", "github.com"]
FieldTypeDefaultDescription
http_handlerbooleanfalseAuto-download and compose with HTTP bridge

When http_handler = true, mik build -c automatically:

  1. Downloads the bridge from ghcr.io/dufeutech/mik-sdk-bridge
  2. Composes your handler with the bridge using WAC

Dependencies are pulled from OCI registries (ghcr.io by default).

[dependencies]
# Format: "user/repo" = "version"
# Resolves to: ghcr.io/user/repo:version
"dufeutech/router" = "latest"
"dufeutech/auth" = "v1.0.0"
"myorg/utils" = "v2.0"
[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 repository
router = { 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" }
Terminal window
# Add from OCI (requires user/repo format)
mik add dufeutech/router
mik add dufeutech/router:v1.0.0
# Add from git
mik add mylib --git "https://github.com/user/repo.git"
# Add local path
mik add utils --path "../utils"

Advanced runtime settings for mik run:

[server]
# Request limits
execution_timeout_secs = 30 # Max handler execution time
max_concurrent_requests = 1000 # Global request limit
max_per_module_requests = 10 # Per-handler limit
max_body_size_mb = 10 # Max request body size
# Cache settings
cache_size = 100 # Max cached modules
max_cache_mb = 256 # Cache memory limit
# Lifecycle settings
shutdown_timeout_secs = 30 # Graceful shutdown drain time
log_max_size_mb = 10 # Log rotation size
log_max_files = 5 # Max log files to keep
watch_debounce_ms = 300 # File watcher debounce

OpenTelemetry tracing configuration:

[tracing]
service_name = "my-service"
otlp_endpoint = "http://localhost:4317" # Jaeger, Tempo, etc.

Override settings via environment:

Terminal window
# Override port
PORT=8080 mik run
# Override bind address (for Docker)
HOST=0.0.0.0 mik run
# Enable debug logging
RUST_LOG=debug mik run
# Enable hot reload mode
MIK_HOT_RELOAD=1 mik run
[project]
name = "api"
version = "0.1.0"
[server]
port = 3000
[composition]
http_handler = true
[project]
name = "api"
version = "0.1.0"
[server]
port = 3000
modules = "modules/"
[composition]
http_handler = true
[dependencies]
"dufeutech/router" = "latest"
"dufeutech/auth" = "v1.0.0"
[project]
name = "production-api"
version = "1.0.0"
description = "Production API service"
[server]
port = 8080
modules = "modules/"
scripts = "scripts/"
static = "public/"
cache_size = 100
max_cache_mb = 512
execution_timeout_secs = 30
max_concurrent_requests = 2000
max_per_module_requests = 50
shutdown_timeout_secs = 60
log_max_size_mb = 50
log_max_files = 10
http_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" }