Core concepts
Vmux Framework models an entire application—state, async work, UI projections, menus, persistence, CLI, and MCP—as one typed Bevy ECS plugin graph.
The eight primitives
| Primitive | Role | Familiar web equivalent |
|---|---|---|
| Crate | Owns one capability or reusable infrastructure boundary | Package / workspace |
| Plugin | Registers components, messages, systems, and child plugins | Feature module / provider |
| Entity | Stable identity for a document, pane, page, session, or operation | Record ID / tree node |
| Component | Canonical state attached to an entity | Normalized store slice |
| System / Observer | Pure state transition reading/writing components and messages | Reducer / command handler |
| Message / EntityEvent | Typed domain request or lifecycle notification | Dispatched action |
#[ui_event] | Typed intent sent from a page to ECS | Mutation input |
#[ui_state] | Read-only snapshot/patch projected from ECS to a page | Query selector / view props |
Composition and target profiles
Select capabilities at compile time via vmux_app Cargo features, and install plugins at startup via VmuxPlugin::builder() or directly on App:
- Headless / Daemon / CLI / MCP: enable
ecs,jobs,store,runner,http-server,quic-server,manifest, or domain cores (layout,flex,project,lsp,extension-core). Zero windowing or WebView dependencies are linked. - Desktop Window (CEF-free): enable
window-nativeandui.WindowHostPlugin(vmux_window) provides reactivewinitwindowing,PageHostPlugin(vmux_page/nativeWry + Dioxus), andFlexPlugin. - Full Browser: add
browser(vmux_browser) only when your application embeds Chromium web tabs.
Shared entity vocabulary
Before inventing feature-specific state machines, compose the shared plugins in vmux_app::ecs:
- Naming, ordering, toggles, status:
RenamePlugin,OrderPlugin,TogglesPlugin,StatusPlugin,TimestampPlugin. - Scoped identity:
IdentityIndexPlugin<Id, Marker>resolves IDs within aChildOf(owner)scope without leaking across independent roots. - Selection:
SelectionPlugin<Scope>enforces at most oneSelected<Scope>per parent/root scope. - Leases:
LeasePluginarbitrates FIFO shared/exclusive access to any entity and releases leases automatically on despawn. - Stale-work guarding:
GenerationPlugin+AtGeneration+Staleautomatically cancel in-flight work when an owner's generation advances;DirtyPlugin<Tag>drives bounded projection passes.
See ECS vocabulary and state in the examples catalog for runnable examples of each plugin.
Operations, async tasks, and reactive wakes
Every reactive crate wakes the host event loop through vmux_ecs::JobWake (WinitWakePlugin on desktop, HeadlessTokioRunner in daemons)—never UpdateMode::Continuous.
- Operations (
OperationPlugin): represent long-running work as canonicalOperationentities withOperationPolicy(SerializePerTarget,SupersedePrevious),OperationTimeout, andOperationRetryexponential backoff. - Async & IO (
vmux_task):TaskPlugin<T>,IoTaskPlugin<T>, and abort-on-dropTokioTasktie background futures to entity lifetimes. - Blocking pools (
vmux_job):JobsPluginandJobPlugin<J>isolate blocking filesystem/CPU work in bounded worker lanes. - Channels, timers & file watching:
AsyncChannelPlugin+#[vmux_ecs::channels], deterministicClock(Clock::fake) +DeadlinePlugin+RateLimiter, andFileWatchPlugin(vmux_watch).
Persistence and autosave
Declare persisted component sets with #[vmux_ecs::store(track; ...)], register SchemaPlugin<S>, and attach AutoSavePlugin<S> + AutoSavePolicy + StorePath for debounced, retryable persistence with graceful exit flushes via ShutdownPlugin.
See examples/primitives/autosave_store.rs and examples/apps/desktop/notes.rs.