# Clone the repository
git clone https://github.com/fsharp-wasm/fsharp-wasm-runtime.git
cd fsharp-wasm-runtime
# Install Node.js dependencies
npm installThe build process has two parts:
npm run build:glueThis copies the thin JS runtime modules from runtime/ to dist/.
npm run build:wasmThis requires the fsharp-wasm compiler. Download the patched compiler and ensure dotnet fable is available with WasmGC support.
npm run buildnpm run serve
# Open http://localhost:8080runtime/ → JS glue modules (core, dom, events, canvas, etc.)
src/Browser/ → F# Browser.* API modules
src/Html/ → HTML DSL (Elements, Attrs, CE Builder)
src/Elmish/ → Minimal MVU engine
demos/ → Demo applications
tests/ → Unit + Integration tests
module MyApp
open Browser.Elmish.Core
open Browser.Html.Elements
open Browser.Html.Attrs
type Model = { Name: string }
type Msg = NameChanged of string
let init () = { Name = "World" }, Cmd.none
let update msg model =
match msg with
| NameChanged s -> { model with Name = s }, Cmd.none
let view model dispatch =
div [] [
h1 [] [text (sprintf "Hello, %s!" model.Name)]
input [
type_ "text"
value_ model.Name
onInput_ (fun s -> dispatch (NameChanged s))
]
]
let start () =
run "app" { Init = init; Update = update; View = view }