From 46aa4cc502098e086ea559b343df3e4261252575 Mon Sep 17 00:00:00 2001 From: Hugo Nijhuis Date: Fri, 9 Jan 2026 16:36:12 +0100 Subject: [PATCH 1/2] Add README quickstart section Provides a complete getting-started guide covering prerequisites, app creation, HTML host setup, build commands, and running the app. Closes #1 Co-Authored-By: Claude Opus 4.5 --- README.md | 104 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..780d405 --- /dev/null +++ b/README.md @@ -0,0 +1,104 @@ +# Iris + +WASM reactive UI framework for Go. + +## Quickstart + +Get from zero to a running app in under 5 minutes. + +### Prerequisites + +- Go 1.23 or later +- Copy the WASM support file: `cp "$(go env GOROOT)/misc/wasm/wasm_exec.js" ./public/` + +### Create your app + +```go +//go:build js && wasm + +package main + +import ( + "fmt" + + "git.flowmade.one/flowmade-one/iris/reactive" + "git.flowmade.one/flowmade-one/iris/ui" +) + +func main() { + count := reactive.NewSignal(0) + + view := ui.NewView() + view.Child(ui.TextFromFunction(func() string { + return fmt.Sprintf("Count: %d", count.Get()) + })) + view.Child(ui.Button(func() { + count.Set(count.Get() + 1) + }, ui.TextFromString("Click me"))) + + ui.NewApp(view) + + // Keep the program running + select {} +} +``` + +### Create the HTML host + +Create `public/index.html`: + +```html + + + + + Iris App + + + + + +``` + +### Build + +```bash +GOOS=js GOARCH=wasm go build -o public/app.wasm ./main.go +``` + +### Run + +Create a simple server or use the built-in host: + +```go +package main + +import ( + "net/http" + + "git.flowmade.one/flowmade-one/iris/host" +) + +func main() { + server := host.New("public", "index.html") + http.ListenAndServe(":8080", server) +} +``` + +Run it: + +```bash +go run server.go +``` + +### Expected output + +Open http://localhost:8080 in your browser. You should see: +- A "Count: 0" text +- A "Click me" button +- Clicking the button increments the count reactively -- 2.49.1 From 260f46e814981c90bdb2d3f8be5f65bda73facfe Mon Sep 17 00:00:00 2001 From: Hugo Nijhuis Date: Fri, 9 Jan 2026 16:40:21 +0100 Subject: [PATCH 2/2] Fix README clarity issues from code review - Add explicit mkdir -p public before wasm_exec.js copy - Specify to save app code as main.go - Specify to save server code as server.go Co-Authored-By: Claude Opus 4.5 --- README.md | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 780d405..037ddc2 100644 --- a/README.md +++ b/README.md @@ -9,10 +9,18 @@ Get from zero to a running app in under 5 minutes. ### Prerequisites - Go 1.23 or later -- Copy the WASM support file: `cp "$(go env GOROOT)/misc/wasm/wasm_exec.js" ./public/` + +### Project setup + +```bash +mkdir -p public +cp "$(go env GOROOT)/misc/wasm/wasm_exec.js" ./public/ +``` ### Create your app +Save this as `main.go`: + ```go //go:build js && wasm @@ -73,7 +81,7 @@ GOOS=js GOARCH=wasm go build -o public/app.wasm ./main.go ### Run -Create a simple server or use the built-in host: +Save this as `server.go`: ```go package main @@ -90,7 +98,7 @@ func main() { } ``` -Run it: +Then run: ```bash go run server.go -- 2.49.1