Type-Safe Routing
Define routes with automatic path, query, and body extraction using derive macros.
Portable WASI HTTP SDK using Component Composition
Write handlers once, run on any WASI-compliant runtime.
mik-sdk provides an ergonomic way to build portable WebAssembly HTTP handlers in pure Rust. It uses a two-component architecture where your handler logic is composed with a bridge component that handles WASI HTTP translation.
use mik_sdk::prelude::*;
routes! { GET "/" => home, GET "/hello/{name}" => hello(path: HelloPath), POST "/users" => create_user(body: CreateInput),}
fn home(_req: &Request) -> Response { ok!({ "message": "Welcome to mik-sdk!" })}
fn hello(path: HelloPath, _req: &Request) -> Response { ok!({ "greeting": format!("Hello, {}!", path.name) })}Type-Safe Routing
Define routes with automatic path, query, and body extraction using derive macros.
Pure Rust JSON
Fast JSON parsing and building with lazy evaluation - no external calls.
Minimal Size
Composed components are ~200KB - optimized for edge deployment.
Portable
Run on any WASI HTTP runtime - build once, deploy anywhere.
mik-sdk uses a two-component architecture for WASI HTTP portability:
| Component | Purpose | Size |
|---|---|---|
| Handler | Your business logic + JSON/time/random | ~158KB |
| Bridge | WASI HTTP adapter | ~72KB |
| Composed | Complete service | ~230KB |
#[derive(Type)]pub struct CreateUserInput { #[field(min = 1, max = 100)] pub name: String, #[field(format = "email")] pub email: String,}
fn create_user(body: CreateUserInput, _req: &Request) -> Response { // body is already parsed and validated ok!({ "name": body.name, "email": body.email })}Lazy JSON parsing extracts only the fields you need - up to 33x faster than full tree parsing:
let parsed = req.json()?; // Parse request bodylet name = parsed.path_str(&["user", "name"]); // ~100nslet age = parsed.path_int(&["user", "age"]); // ~100nsUses native WASI interfaces automatically on WebAssembly:
wasi:clocks/wall-clock for timewasi:random/random for cryptographic randomnesswasi:http/outgoing-handler for HTTP client (optional)Build parameterized SQL queries with Mongo-style filter syntax:
let (sql, params) = sql_read!(users { select: [id, name, email], filter: { active: true, age: { $gte: 18 } }, order: [-created_at, id], limit: 20,});mik-sdk is an experimental project for learning and internal use. It demonstrates WASI P2, WAC composition, and component model patterns.