MALDA™ Reference Manual

The AI-First Programming Language - Version 1.0.39

25. Web UI Overview

MALDA supports more than one way to build user interfaces. The models below share HTTP and routing concepts but target different runtimes and delivery styles. Start here before diving into a specific chapter. Prefer one model per surface (IDE UI1002 when a file mixes @PAGE/@AIPAGE with ui.mount/ui.render).

First-read stop. After Learn MALDA, pick one row in the table — do not read chapters 26–31 in order. Smallest files: Examples/Web/ for pages and REST; malda new game / Examples/Games/ for canvas. The rest of this page is the decision guide.
Full-stack context: For how UI, API, database, and agents fit together, see 31. Full-Stack Development with MALDA. New to HTTP vocabulary (middleware, CSRF, CORS, JWT, HTTPS)? Read 29.1.1 Concepts primer first. For server-driven UI runtime/host internals (patch protocol, UIHost), see docs/ui-framework.md.

25.1 Choose your UI model

Model Best for Key constructs Chapter
HTML fragment components Form and list pages that return HTML strings, with targeted fragment updates and optional SSE component, @ACTION, @LIVE, componentFragment, componentState* 26. Web UI Server Components (§ 26.2)
Server-driven ui.* trees Incremental patch UI hosted by UIHost; controls are node trees, not HTML strings ui.button(props, …), ui.mount / ui.render, ui.state 26. Web UI Server Components (§ 26.3)
HttpServer pages Route-first apps that return full HTML documents, AI-generated pages, or classic server-rendered sites HttpServer, @PAGE, @AIPAGE, HTMLCache, generateUI() 27. HttpServer & HTML UI Generation
Browser JavaScript UI that runs in the browser from MALDA transpiled to JavaScript (DOM apps, hybrid frontends) dom.*, template mode, @client() 28. Browser JavaScript UI Backend
Browser games Canvas / 3D / GPU kernels. JS-only; preview with malda play game.*, three.*, @shader() 28.9–28.10, 35.3, 39

25.2 Decision guide

Pick HTML fragment components when…

Pick server-driven ui.* trees when…

Pick HttpServer / @PAGE when…

Pick browser JavaScript when…

Pick browser games when…

25.3 How the models relate

                    ┌─────────────────────────────────────┐
                    │         MALDA Web UI choices          │
                    └─────────────────────────────────────┘
                                      │
     ┌───────────────┬────────────────┼────────────────┬────────────────┐
     ▼               ▼                ▼                ▼
 HTML fragments   ui.* trees     HttpServer / @PAGE   Browser JS
 (component +     (mount/render  (full pages +        (transpile +
  ACTION + LIVE)   + UIHost)      AI HTML)             dom.* / canvas)
     │               │                │                │
     └───────────────┴────────────────┴────────────────┘
                                      │
                              HTTP / REST API layer
                         (see REST API + REST Web Client)

You can combine models in one product when boundaries are explicit: for example, @PAGE for marketing routes, a ui.* app shell, and a browser JS bundle for an interactive widget. See 29. REST API Server for JSON endpoints that any UI model can call.

25.4 Runtime boundary reminder

See 2. Tools & Tooling (Runtime modes at a glance) for interpreter vs transpile vs JavaScript trade-offs.

25.5 Browser games

JS-only surface

game.*, three.*, and @shader() live in 28.9–28.10, not in this hub’s server models. Start with malda new game then malda play app.malda. Catalog snippet: 35.3. Folder: Examples/Games/. Chapter 39 is a playable showcase, not the language contract.

See Also