Skip to content

Latest commit

 

History

History
133 lines (96 loc) · 3.81 KB

File metadata and controls

133 lines (96 loc) · 3.81 KB

Getting Started

Choose the path that matches what you are trying to do.

A. Browser Playground (no install)

Open the browser Playground or the website tutorial at ?section=tutorial. Edit main.mbt and a controlled moon.pkg without installing a native toolchain. Choose a lesson with /playground/?example=03-state-events.

The visible editor is implemented with MoUI and moui_richtext. The browser host only provides the Worker, Wasm load, and preview iframe bridge.

Local website + Playground (one shot)

Package the same layout as GitHub Pages (dist/pages + nested playground):

sh scripts/package-website-site.sh
cd dist/pages && python3 -m http.server 8080 --bind 127.0.0.1

Then open http://127.0.0.1:8080/ (home) and http://127.0.0.1:8080/playground/ (Playground).

Local Playground-only preview

moon build website/playground/web_wasm --target wasm-gc
node scripts/generate-playground-assets.mjs --out dist/playground

Serve dist/ and open dist/playground/.

Playground user code is compiled for wasm-gc against an app-safe allowlist (moui facades + views). Runtime, renderer, and arbitrary registry imports are rejected before compilation.

B. Local multiplatform project (recommended, ~10 minutes)

Create a real project outside this monorepo with the standalone CLI:

moon install wzzc-dev/moui_cli/cmd/moui
# Or from a MoUI checkout: moon install ./moui_cli/cmd/moui

moui new my_app
# Optional smaller skeleton:
# moui new my_app --template hello

cd my_app
moon update
moon check

moui new writes shared app logic plus Web and the current host desktop entrypoint (macOS / Windows / Linux Skia). Mobile platforms are opt-in with --platform android|ios|harmonyos and --bundle-id.

Run desktop (host-dependent)

# macOS
moon run macos_skia --target native

# Windows
moon run windows_skia --target native

# Linux (Wayland)
moon run linux_skia --target native

Run Web

moon build web_wasm --target wasm-gc
# Serve the web_wasm package (static HTTP) and open index.html in a
# WebGPU-capable browser.

Run mobile (Android / iOS / HarmonyOS)

moui run orchestrates build → install → launch on a connected device or emulator. Set the SDK paths once via moui config (XDG-backed), then drive the loop with moui run / moui devices / moui verify.

# Configure SDK paths (one-time)
moui config set harmonyos.sdkHome /path/to/commandline-tools
moui config set android.sdkHome /opt/android-sdk
moui config set android.ndkHome /opt/android-ndk

# List connected devices
moui devices

# Build, install, and launch on the first matching device
moui run harmonyos showcase
moui run android showcase
moui run ios showcase

# Run the runtime probe and write verify-manifest.json
moui verify android showcase --require-passed

What you get

Path Role
app/ Shared TEA model / update / view (Program::simple)
web_wasm/ Thin browser entrypoint
*_skia/ Thin native Skia entrypoint for the host OS

Do not start by cloning the full MoUI monorepo unless you are changing the framework. For monorepo examples, see Examples: counter is the minimal multiplatform app, while Showcase's Platform workspace contains the Effect/Subscription and host-service recipes.

More detail: App templates, CLI README, Non-render cookbook.

C. This repository (framework contributors)

git clone --recurse-submodules https://github.com/wzzc-dev/MoUI.git
cd MoUI
sh scripts/ci-moon-update.sh
sh scripts/check.sh --profile daily
moon run examples/counter/macos_skia --target native

See Development and AGENTS.md for package boundaries and validation gates.