Framework quickstart
Get a Vmux Framework application running in minutes—either as a CEF-free native desktop window app or a renderer-free headless ECS service.
1. Scaffold a new project with the CLI
Create a standalone project from a template (desktop, web, tui, mobile, or service), run it with live reload, and bundle it for distribution:
vmux new my_app --template desktop
cd my_app
vmux serve
vmux bundle --platform macos
Or run any example in a Vmux checkout (see the Framework examples catalog for all 42 examples):
vmux example --list
vmux example desktop_counter
vmux example web
vmux example tui
vmux example mobile
vmux example service
Pass --headless (or VMUX_EXAMPLE_HEADLESS=1) to run interactive examples as a deterministic one-shot smoke check in CI or a terminal.
2. Build a minimal desktop window app (vmux_sdk)
For standalone MIT OR Apache-2.0 applications without Vmux product features or Chromium, depend on vmux_sdk with window-native and ui (or use vmux_app when composing inside the GPL-3.0 product monorepo):
[dependencies]
bevy_ecs = "0.20"
dioxus = "=0.7.9"
rkyv = { version = "0.8", features = ["alloc"] }
serde = { version = "1", features = ["derive"] }
vmux_api = { git = "https://github.com/vmux-ai/vmux", rev = "<commit>" }
vmux_sdk = { git = "https://github.com/vmux-ai/vmux", rev = "<commit>", features = ["window-native", "ui"] }
Define one #[ui_state], one #[ui_event], one Dioxus Page, and compose them with WindowHostPlugin:
use bevy_ecs::prelude::*;
use dioxus::prelude::*;
use vmux_sdk::prelude::*;
#[ui_state(Default, Eq)]
struct CounterUiState {
count: i32,
}
#[ui_event(Eq)]
struct CounterDelta {
delta: i32,
}
#[derive(Component, Default)]
struct CounterValue(i32);
struct CounterPlugin;
impl Plugin for CounterPlugin {
fn build(&self, app: &mut App) {
app.add_plugins(UiPlugin::<CounterUiState, CounterDelta>::default())
.add_observer(attach_counter)
.add_observer(apply_delta);
}
}
fn attach_counter(
trigger: On<Add, UiIpcReady>,
pages: Query<(), With<HostedPage>>,
mut writer: UiStateWriter<CounterUiState>,
mut commands: Commands,
) {
let page = trigger.event_target();
if pages.contains(page) {
commands.entity(page).try_insert(CounterValue(0));
writer.push(page, CounterUiState { count: 0 });
}
}
fn apply_delta(
trigger: On<UiEvent<CounterDelta>>,
mut counters: Query<&mut CounterValue>,
mut writer: UiStateWriter<CounterUiState>,
) {
let page = trigger.event().page;
if let Ok(mut value) = counters.get_mut(page) {
value.0 += trigger.event().delta;
writer.push(page, CounterUiState { count: value.0 });
}
}
#[component]
fn CounterPageView() -> Element {
let binding = use_ui_state::<CounterUiState>();
let count = binding.state.read().count;
rsx! {
div {
span { "{count}" }
button { onclick: move |_| { let _ = send_ui_event(&CounterDelta { delta: 1 }); }, "+" }
}
}
}
static COUNTER_PAGE: Page = Page::pane("app://counter/", CounterPageView)
.titled("Counter")
.with_permissions(&[CounterUiState::PERMISSION, CounterDelta::PERMISSION]);
fn main() {
App::new()
.add_plugins((
DefaultPlugins.set(WindowHostPlugin::new(
WindowHostConfig::new("Counter")
.size(480, 320)
.page(&COUNTER_PAGE),
)),
CounterPlugin,
))
.run();
}
See the full runnable version in examples/apps/desktop/counter.rs.
3. Build a headless, TUI, or server app
Headless apps bootstrap with MinimalPlugins or ServerPlugins and omit window and ui completely so zero windowing, WebView, or Chromium crates compile:
use vmux_sdk::prelude::*;
let mut app = App::new();
app.add_plugins((
MinimalPlugins,
FlexPlugin,
));
app.update();
For long-running background daemons and HTTP/QUIC web apps, add ServerPlugins (which manages TokioRuntime and HeadlessRunnerPlugin automatically) and call .run()—see examples/apps/web.rs and examples/apps/service.rs.
Next steps
- Learn the ownership and composition model in Core concepts.
- Wire multi-pane layouts, menus, and assets in Windows, pages, and menus.