tpt-appfront
RustWrite your UI once in Rust and render it anywhere: native/WASM canvas (egui+taffy), reactive DOM, semantic HTML, terminal UI (ratatui), JSON-LD/AI-agent schema, and an OS-webview desktop shell — served to the right client by a smart backend router.
Languages
TPT AppFront
A unified, hardware-accelerated, AI-native UI framework: write your UI once in Rust as an abstract UITree, render it to native canvas, a fine-grained-reactive DOM, semantic HTML, machine-readable AI/JSON-LD schemas, a terminal UI, or an OS-webview desktop shell — from one codebase.
See spec.txt for the full design document and todo.md for build progress (most backends are functional but not every stretch item is complete — check there before assuming a feature exists).
Quickstart
See docs/quickstart.md: install the CLI, tpt-appfront init, tpt-appfront dev, tpt-appfront build.
Workspace layout
crates/tpt-appfront-core—UITreeAST, the reactiveSignalsystem, virtual scroll, styling utilities, devtools inspector, static-tree cachingcrates/tpt-appfront-dom— fine-grained-reactive real DOM backend (web-sys), wasm32-onlycrates/tpt-appfront-canvas— egui/taffy hardware-accelerated canvas backend (glow renderer), native + wasm32crates/tpt-appfront-html— semantic HTML (SSR/SSG) backend for crawlers, withdata-ai-*/OpenGraph tagscrates/tpt-appfront-ai-schema— JSON-LD (schema.org) and custom AI Schema output backendcrates/tpt-appfront-server— Axum "smart router" that serves the right backend (DOM/HTML/AI-Schema) per client type (browser, crawler, AI agent, social bot), plus PWA support and aPOST /commandbridgecrates/tpt-appfront-tui— terminal UI backend (ratatui/crossterm), keyboard-drivencrates/tpt-appfront-webview— thin OS-webview desktop shell (wry + tao) hosting thetpt-appfront-domWASM bundle, no Electron/Node requiredcrates/tpt-appfront-mcp— MCP server exposing the programmatic AI-agent API as JSON-RPC tools over stdiocrates/tpt-appfront-macros—#[appfront::component]helper macro and theview!/rsx!templating macrocrates/tpt-appfront-cli— thetpt-appfrontCLI (init/dev/build/generate/ingest/benchmark/optimize/doctor/add)crates/tpt-appfront-templates— backend-agnostic starter UI templates (login_form,dashboard_shell,settings_list) as statelessUITreebuilder functions, usable from any backend
Examples (examples/counter-dom, counter-canvas, counter-tui, counter-webview, ssr-page, ai-agent-demo, todo-app, templates-demo, node-graph) live outside the workspace — each has its own Cargo.toml so it can resolve wasm-bindgen/trunk dependencies independently. All are committed and built in CI (see .github/workflows/ci.yml); scaffold new ones locally with tpt-appfront init (see docs/quickstart.md). templates-demo composes the tpt-appfront-templates starter UIs; node-graph shows the recommended raw-egui escape hatch for GPU/canvas-style interactions the UITree flexbox can't express.
When the UITree model doesn't fit, see docs/escape-hatches.md for the { expr }/ContainerBuilder::with composition pattern and the raw-egui escape hatch.
License
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.