WaterUI CLI Workflow
WaterUI ships a first-party CLI named water. Install it from the workspace checkout so that every example in this book can be scaffolded, run, and packaged without leaving your terminal.
cargo install --path cli --locked
Scaffold a Project
Create a new playground app with the runtime backends you need:
water create --name "Water Demo" \
--bundle-identifier com.example.waterdemo \
--backend swiftui --backend android --backend web \
--yes --dev
--devkeeps the generated project pinned to the local WaterUI sources while new releases are cooking.--yesskips prompts so commands can run inside scripts.- Repeat
--backendfor each platform you plan to target. You can always runwater add-backend <name>later.
The command produces a Rust crate, Water.toml, and backend-specific folders under apple/, android/, and web/.
Run with Hot Reload
water run detects connected simulators and browsers, recompiles your crate, and streams code changes to the selected backend:
water run --platform web --project water-demo
- Use
--device <name>to target a specific simulator/emulator fromwater devices. - Add
--releaseonce you need optimized builds for profiling. - Disable the file watcher with
--no-watchif your CI only needs a single build.
Package Native Artifacts
Produce distributable builds when you are ready to ship:
water package --platform android --project water-demo --release
water package --platform ios --project water-demo
Android packaging accepts --skip-native when custom Rust artifacts are supplied. Apple builds honour the standard Xcode environment variables (CONFIGURATION, BUILT_PRODUCTS_DIR, etc.) when invoked from scheme actions.
Inspect and Repair Toolchains
Run doctor and devices early in each chapter to ensure your environment is healthy:
water doctor --fix
water devices --json
doctorvalidates Rust, Swift, Android, and web prerequisites. With--fixit attempts to repair missing components, otherwise it prints actionable instructions.devicesemits a machine-readable list when--jsonis present, which is perfect for CI pipelines or automation scripts.
Automation Tips
All commands accept --format json (or --json). JSON output disables interactive prompts. Supply --yes, --platform, and --device up front to avoid stalling non-interactive shells.
Because every walkthrough in this book starts from a real CLI project, keep this reference handy: it is the quickest path to recreating any example locally.