libs/web
High-Throughput Web Framework & Router
A fast, modular web application framework in Kale. Features a lightning-fast radix tree URL router with wildcard and parameter capture (/api/v1/users/:id), structured JSON response generation, and composable middleware pipelines.


Sub-Millisecond Multi-Cursor Editing
Unlike line-array or gap-buffer architectures, the Kale Piece Table holds an immutable original file buffer coupled with an append-only edit buffer. Loading a 100MB file takes under 1ms because no memory copying occurs.
import "libs/web/app.kl" as web;
fn handle_get_project(req: *web.Request, res: *web.Response) -> void {
let slug: string = web.param(req, "slug");
web.json(res, 200, "{\"project\": \"" + slug + "\", \"status\": \"active\"}");
}
fn main() -> int32 {
let app: web.WebApp = web.new_app();
web.get(&app, "/api/projects/:slug", handle_get_project);
web.listen(&app, 8080);
return 0;
}Deterministic command-line invocations to build, link native dynamic dependencies, and run automated regression tests:
kale build tests/test_web_router.kl -o bin/test_web.exe -lws2_32./bin/test_web.exeGPG Key 1B917D4779A6102E • Continuous integration with automated symbol verification.
Matches dynamic path parameters and wildcards in sub-microsecond time with zero memory allocations.
Pluggable request/response interceptors for logging, CORS, security headers, and authentication.
Lightweight HTML template interpolation engine for dynamic page rendering.