Repolode
Millillion

Millillion/lasm

Lean 4 ahead-of-time compiler that turns ordinary Lean programs into WebAssembly for Node, serverless, edge, WASI and browser targets.

Stars
103
Forks
7
Open issues
1
Last commit
5 hours ago

What is it?

Lasm compiles ordinary Lean 4 programs ahead of time to WebAssembly so one Lean codebase can run as a Node server, a serverless or edge function, a WASI or Fastly module, or a browser app. It ships on npm and bundles Lean and its build tools, so developers only need Node, Bun or Deno installed.

Lasm provides JavaScript and npm interop through a Lean import and one declaration per called function, plus Lean libraries for HTTP (Lasm.Fetch), browser UI with a diff that is proved correct (Lasm.UI), typed client/server APIs (Lasm.RPC) and DOM access (Lasm.Web). Because the code is Lean, properties of the deployed code can be written as theorems and checked at build time. A flagship example, a RealWorld app named Conduit, includes 117 proved theorems about its authorization, pagination and validation logic.

Deployment targets include AWS Lambda, Vercel, Netlify, Azure Functions, Google Cloud Functions, Cloudflare Workers, Deno Deploy, Fastly Compute, and plain WASI and browser outputs. Programs cannot elaborate or evaluate Lean at run time, and edge, Bun/Deno, WASI and browser builds run single-threaded without sockets or processes.

Key features

  • 01Compiles ordinary Lean 4 programs ahead of time to WebAssembly.
  • 02Builds for Node, AWS Lambda, Vercel, Netlify, Cloudflare Workers, Deno Deploy, Fastly, WASI and browsers.
  • 03Calls npm packages and JavaScript functions from Lean via one-line @[js] declarations.
  • 04Provides Lean libraries for HTTP, browser UI, typed client/server RPC and DOM access.
  • 05Installs via npm with Lean and build tools bundled; project templates via npm create.

Use cases

  • Writing a Node REST API in Lean that uses Hono or Express.
  • Deploying a Lean function to serverless or edge platforms.
  • Building a browser single-page app in Lean with server-rendered output.
  • Proving invariants such as authorization rules in a web backend.

Quick start

  1. 1

    Create a new project with the Hono template

    npm create @lasm@latest my-app -- --template hono
  2. 2

    Enter the project and install dependencies

    cd my-app && npm install
  3. 3

    Start the development server

    npm run dev

Things to know

  • Lean-based toolchain: the first build downloads about 250–275 MB of Lean and build tools.
  • Edge, Bun/Deno, WASI and browser builds run single-threaded without sockets or processes.
  • Compiler requires Node 24 or newer, with Bun or Deno as the only alternative runtimes.

In collections

Topics

FAQ

What is lasm?
Lean 4 ahead-of-time compiler that turns ordinary Lean programs into WebAssembly for Node, serverless, edge, WASI and browser targets. Lasm compiles ordinary Lean 4 programs ahead of time to WebAssembly so one Lean codebase can run as a Node server, a serverless or edge function, a WASI or Fastly module, or a browser app. It ships on npm and bundles Lean and its build tools, so developers only need Node, Bun or Deno installed.
Is lasm free to use? What license does it have?
lasm is open source under the MIT license. Check the license terms before using it in commercial products.
Is lasm still maintained?
Actively maintained. The last commit to lasm was on Nov 7, 2026.
What can I use lasm for?
Writing a Node REST API in Lean that uses Hono or Express. Deploying a Lean function to serverless or edge platforms. Building a browser single-page app in Lean with server-rendered output. Proving invariants such as authorization rules in a web backend.
How do I install lasm?
Create a new project with the Hono template: npm create @lasm@latest my-app -- --template hono Enter the project and install dependencies: cd my-app && npm install Start the development server: npm run dev
Where can I get lasm?
The source code and installation instructions are on GitHub: https://github.com/Millillion/lasm

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects