Project Creation
dx new
Create a new Dioxus project from a template.
<PATH>- Directory where the project will be created
--name <NAME>- Project name (defaults to directory name)--template <TEMPLATE>- Template path (default:gh:dioxuslabs/dioxus-template)--branch <BRANCH>- Git branch to use--revision <REV>- Git commit hash--tag <TAG>- Git tag--subtemplate <PATH>- Subfolder within template repository--option <KEY=VALUE>- Template-specific options--yes- Skip prompts, use defaults--vcs <VCS>- Version control system:git,none
dx init
Initialize Dioxus in an existing project directory.
Development
dx serve
Build, watch, and serve the project with hot-reload.
--address <ADDR>- Server address (default:127.0.0.1)--port <PORT>- Server port (default:8080)--open [BOOL]- Open in browser (default:true)--cross-origin-policy- Set CORS to same-origin
--hot-reload [BOOL]- Enable hot-reload (default:true)--hot-patch- Enable Rust code hot-patching (experimental)--watch [BOOL]- Watch filesystem for changes (default:true)--wsl-file-poll-interval <SECS>- File polling interval for WSL (default:2)
--interactive [BOOL]- Interactive TUI mode (default:true)--always-on-top [BOOL]- Keep desktop window on top
--platform <PLATFORM>- Target platform:web,desktop,ios,android--features <FEATURES>- Cargo features to enable--package <PACKAGE>- Workspace package to build--example <EXAMPLE>- Run an example--bin <BIN>- Binary target to build--release- Build in release mode--target <TARGET>- Rust target triple
r- Trigger manual rebuildp- Toggle automatic rebuilds on file changev- Toggle verbose logging/- Show all commandsCtrl+C- Exit server
dx run
Run the project without interactive mode or hot-reload.
dx serve but defaults to:
--interactive false--hot-reload false--watch false
Building
dx build
Build the Dioxus app and all assets for production.
--release- Build with optimizations (default for production)--platform <PLATFORM>- Target platform--features <FEATURES>- Cargo features--package <PACKAGE>- Workspace package--target <TARGET>- Rust target triple--fullstack [BOOL]- Build client and server--ssg- Pre-render all static routes--fat-binary- Include symbols for hot-patching--force-sequential [BOOL]- Build server before client (default in CI)
Dioxus.toml (out_dir field, default: dist/).
dx bundle
Bundle the app into a platform-specific distributable package.
--package-types <TYPES>- Bundle formats (e.g.,dmg,msi,appimage,deb)--out-dir <DIR>- Output directory for bundles- All
dx buildoptions are also supported
app- macOS app bundledmg- Disk image
msi- Windows Installerexe- Executable installer
deb- Debian packagerpm- Red Hat packageappimage- AppImage
ios-bundle- iOS app bundle (requires codesigning)aab- Android App Bundleapk- Android APK
Code Quality
dx check
Check the project for errors without building.
--file <PATH>- Check specific file--package <PACKAGE>- Workspace package- Platform and build options
dx fmt
Automatically format RSX macros.
--check- Check formatting without modifying files (exits 1 if changes needed)--file <PATH>- Format specific file (use-for stdin/stdout)--raw <CODE>- Format raw RSX code--split-line-attributes- Put each attribute on separate line--all-code- Format Rust code before RSX (runsrustfmtfirst)--package <PACKAGE>- Workspace package
Configuration
dx config
Manage Dioxus configuration.
dx config init <NAME>- CreateDioxus.tomlwith all fieldsdx config show- Display current configuration
Diagnostics
dx doctor
Diagnose system setup and verify tooling installation.
- Rust toolchain version and sysroot
wasm-optinstallation and locationwasm-bindgenversion and binary- Tailwind CSS installation
- Editor extensions (VS Code, Cursor)
- Platform-specific SDKs (Xcode, Android SDK)
dx print
Print build information in structured format for third-party tools.
dx print cargo-args- Cargo compilation argumentsdx print linker-args- Linker flags used by DX
Utilities
dx translate
Translate HTML into Dioxus RSX.
dx components
Manage components from the dioxus-component registry.
dx self-update
Update the Dioxus CLI to the latest version.
Advanced Commands
dx tools
Run internal build tools.
dx tools assets- Build assets for specific targetdx tools hotpatch- Hot-patch a fat binary
Common Patterns
Development Workflow
Production Build Workflow
Fullstack Development
Exit Codes
Commands return standard exit codes:0- Success1- Error occurred
dx run or dx build in CI/CD pipelines for proper error propagation.
Environment Variables
CI- When set, forces sequential builds in fullstack modeRUST_LOG- Control logging verbosity (e.g.,RUST_LOG=debug dx serve)
Next Steps
Configuration
Configure Dioxus.toml options
Hot-Reload
Understanding hot-reload systems