Lasm is a toolchain for writing web and server applications in Lean 4, compiling ordinary Lean programs ahead of time to WebAssembly and packaging them for JavaScript and WASM runtimes. A single codebase can target Node, serverless platforms, edge services, WASI, Fastly, or browsers. It installs Lean and its build tools through npm, and offers libraries for HTTP, browser interfaces, typed APIs, web APIs, and key-value storage. Developers can also call npm packages from Lean by declaring JavaScript bindings. The project includes templates and examples for command-line tools, REST APIs, serverless functions, and browser apps, with builds and deployment targets tested in CI.
Its central case for the approach is Conduit, a full-stack Medium-style application written in Lean, including its API, browser interface, and proofs. It contains 117 checked theorems about properties such as authorization, unique slugs, pagination, validation, JSON round trips, and Markdown link safety; the proofs cover code that also runs in the deployed app. Conduit passes the official RealWorld API tests on Node, Cloudflare Workers, and Bun, and its browser tests pass across several browsers and targets. The verification has important limits: SQL behavior, JSON text handling, request concurrency, and the Lean, Lasm, and JavaScript runtimes are trusted rather than proved, and full specification compliance is tested, not formally established. Node builds retain Lean’s broader runtime capabilities; edge, browser, and other constrained targets run single-threaded and lack some facilities, including sockets and processes.
Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.