Getting Started with FSharp WasmGC
A practical step-by-step guide to compiling your first F# project to WebAssembly GC using FSharp WasmGC.
FSharp WasmGC compiles F# to WebAssembly GC — and around the compiler there is a platform: libraries, a graphics stack, editors and a server host, all written in F#. Compact modules, no garbage collector and no runtime library to ship, in the browser and on the edge.
Why FSharp WasmGC?
A compiler backend that maps F# constructs directly to WebAssembly GC types — no boxing hacks, and the engine's own garbage collector instead of one in the binary.
WasmGC output uses the engine's garbage collector, so no GC or runtime sits inside the binary: whole demo applications are 6–172 KB. What a module touches outside itself — the DOM, the network, storage — comes through imports that a small host provides.
Pattern matching, discriminated unions, closures, tail calls — all compile correctly to native WasmGC constructs without compromise.
F# records map to struct types. F# lists become linked structs. Closures become typed function references. Clean mapping, no overhead.
Built on a fork of Fable's F# parser and type-checker (MIT). The code generation back end, the base library and the hosts are ours.
Automatic WIT export generation. Compile F# to WasmGC components and link them at the Wasm level — no JS glue needed between modules.
Fully open. Community-driven development. Every sprint is documented in detail. Contributions welcome from day one.
The platform
The compiler is the flagship, and what is built on it is the proof: libraries, a canvas graphics stack, a widget editor, a newsletter designer, server modules and the host that runs them. What works, what grows and what is only planned is written on each card.
fsharp-wasm, fsharp and Fable — F# in, WebAssembly GC out. Everything else is built to prove it and to use it.
fsharp-wasm-core, fsharp-wasmecto — The lowest layer: everything above uses it, it uses nothing of ours.
fsharp-wasm-graphics, fsharp-glyph-aura — Drawing, laying out, picking and typesetting, in F#, for a canvas and for a screen reader.
fsharp-wasm-runtime — The runtime that runs a module in a page, and the pages that show what it does.
fsharp-wasm-ide, fsharp-wasm-newsletter — Programs that make the stack show what it can do. They are gates too: a program that stops compiling is a finding for the compiler.
fsharp-wasm-backend, fsharp-wasm-edge — The same language on the server: a module, a small host, one adapter per platform.
fsharp-wasm-accounting, A data science library, WIT with Rust libraries — Plans, in the order we expect to need them. Nothing here works yet, and the cards say so.
Step 1: Get the compiler
Download a release (a self-contained binary with the F# base library beside it) or build from source. A .NET 10 SDK has to be on the PATH.
Step 2: Write idiomatic F#
Create an .fsproj and write standard F#. No special attributes or interop layer needed for core functionality.
Step 3: Compile to WasmGC
Run the compiler. Get a .wasm binary and a human-readable .wat text representation you can inspect and debug.
Step 4: Deploy anywhere
Run it in a browser, Node, Deno or Bun, or on Cloudflare, Vercel and Netlify: hosts for those exist (see the demos and the backend page). Any WasmGC-capable runtime works.
Under the hood
A fork of Fable provides the F# AST and the type information. FSharp WasmGC replaces the code generation back end.
The compiler emits WebAssembly Text Format (WAT) before assembling. You can inspect exactly what Wasm your F# produces.
Compile entire projects with multiple F# source files and a growing Base Class Library (BCL) implemented in WasmGC itself.
WIT files are generated from your module's exports. Today that covers primitive types; strings and records need adapters in the module, which is the next step on the roadmap.
When wasm-tools is available, WasmGC components are assembled automatically. Link multiple F# modules at the Wasm level.
Import functions from other Wasm components using F#'s [
Counted in a recorded run on 2026-11-16 and counted again on 2026-11-22 for what changed since (QuickTest, String ABI, Host (graphics), Widgets, Interact, the widget editor, the newsletter designer, the libraries of the core, the backend and the edge): every suite, demo and benchmark is listed on the Tests, Demos and Benchmarks pages.
Thirteen kernels in F# and in JavaScript, the size of every module and the time to download and compile it — and a server module against hand-written JavaScript and Hono on Node, Bun and workerd, where it is close on a small answer and far behind on a long one, with the profile of why. The method, the raw reports and what is not measured yet are with the numbers.
Deep dives, release notes, and tutorials on F# compiler internals, WasmGC design, and functional programming for the web platform.
A practical step-by-step guide to compiling your first F# project to WebAssembly GC using FSharp WasmGC.
A technical deep dive into how WasmGC's type system aligns with F# semantics — and why compiling F# to WasmGC produces cleaner output than any JS-based approach.
We are building a clean-room F# compiler backend that targets WebAssembly GC directly. Here is why, how, and what is coming next.
FSharp WasmGC is open source and actively developed. Contributions, issues, and discussions are all welcome on GitHub.