Browse documentation
Tauri Commands
Backend command reference for DevStackBox.
On this page
- How to Use This Reference
- Frontend Constants File
- Command Reference
- System Commands
- Tray / Window Commands
- MySQL Commands
- Migration Commands
- Apache Commands
- PHP Commands
- Log Commands
- Config Commands
- Terminal Commands
- Security Commands
- SSL Commands
- Virtual Host and Project Commands
- Full Backup Commands
- Shared Rust Types
ServiceInfo(Rust) =ServiceStatus(TypeScript)PHPVersionInfo(Rust) =PHPVersion(TypeScript)- Valid
serviceParameter Values - Full
generate_handler!Registration (lib.rs) - Adding a New Command
- Unreleased database workspace commands
- Managed diagnostic logs
Single source of truth for all backend IPC commands.
Every command registered in src-tauri/src/lib.rs (generate_handler!) is documented here.
Every command name used in the frontend must match exactly what is listed here.
Rule: Before writing safeInvoke("some_command") anywhere in the frontend, check this file first. If the command is not listed here, it does not exist in the backend.
How to Use This Reference
- Find the command you need in the table below.
- Check its parameters and return type.
- Use the exact command name string from the "Command Name" column.
- If it is not already in
src/lib/commands.ts:TAURI_COMMANDS, add it there. - Call it via
safeInvoke<ReturnType>(TAURI_COMMANDS.group.commandName, { params }).
Frontend Constants File
All command name strings are centralized in src/lib/commands.ts in the TAURI_COMMANDS constant.
Do not use hardcoded command name strings in component files.
Pattern:
const result = await safeInvoke<ReturnType>(
TAURI_COMMANDS.group.commandName,
{ paramName: value },
);Command Reference
System Commands
| Command Name | Source File | Parameters | Returns | Notes |
|---|---|---|---|---|
check_binaries | commands/system.rs | none | HashMap<String, bool> | Keys: mysql, apache, php |
debug_paths | commands/system.rs | none | HashMap<String, String> | Debug only |
debug_installation | commands/system.rs | none | HashMap<String, String> | Debug only |
start_all_services | commands/system.rs | none | String (summary) | |
stop_all_services | commands/system.rs | none | String (summary) | |
create_directory_structure | commands/system.rs | none | String | |
get_system_info | commands/system.rs | none | SystemInfo | OS, versions, paths |
get_autostart | commands/system.rs | none | bool | Launch-on-login state |
set_autostart | commands/system.rs | enabled: bool | String |
Tray / Window Commands
| Command Name | Source File | Parameters | Returns | Notes |
|---|---|---|---|---|
show_main_window | commands/tray.rs | none | () | |
hide_to_tray | commands/tray.rs | none | () | |
set_tray_tooltip | commands/tray.rs | tooltip: String | () | Called on every status poll |
quit_app | commands/tray.rs | none | () |
MySQL Commands
| Command Name | Source File | Parameters | Returns | Notes |
|---|---|---|---|---|
start_mysql | commands/mysql.rs | none | bool | |
stop_mysql | commands/mysql.rs | none | bool | |
get_mysql_status | commands/mysql.rs | none | ServiceInfo | |
toggle_mysql | commands/mysql.rs | none | bool (new running state) | |
test_mysql_config | commands/mysql.rs | none | String | |
backup_mysql_database | commands/mysql.rs | none | String (path) | Dumps all databases |
backup_mysql_database_named | commands/mysql.rs | database: String | String (path) | |
list_mysql_databases | commands/mysql.rs | none | String[] | |
list_mysql_databases_detailed | commands/mysql.rs | none | DatabaseInfo[] | name + table count + size |
pick_sql_restore_file | commands/mysql_import.rs | none | String | null | Native file picker for .sql |
get_sql_restore_file_info | commands/mysql_import.rs | path: String | SqlRestoreFileInfo | Size + sniff hint for restore mode |
restore_mysql_from_file | commands/mysql_import.rs | file_path, restore_mode, initial_database?, create_database | String | Streams file to mysql stdin |
apply_php_recommended_import_limits | commands/mysql_import.rs | none | String | Sets recommended php.ini import limits |
list_mysql_users | commands/mysql.rs | none | MySqlUser[] | |
create_mysql_user | commands/mysql.rs | username: String, password: String, host: String | String | |
drop_mysql_user | commands/mysql.rs | username: String, host: String | String | |
set_mysql_user_password | commands/mysql.rs | username: String, host: String, password: String | String |
Migration Commands
| Command Name | Source File | Parameters | Returns | Notes |
|---|---|---|---|---|
detect_xampp_installations | commands/migration.rs | none | XamppDetection[] | Scans default XAMPP paths |
import_from_xampp | commands/migration.rs | xampp_root: String, copy_htdocs: bool | XamppImportResult | Copies htdocs into www |
Apache Commands
| Command Name | Source File | Parameters | Returns | Notes |
|---|---|---|---|---|
start_apache | commands/apache.rs | none | bool | |
stop_apache | commands/apache.rs | none | bool | |
get_apache_status | commands/apache.rs | none | ServiceInfo | |
toggle_apache | commands/apache.rs | none | bool | |
test_apache_config | commands/apache.rs | none | String | Runs httpd -t |
PHP Commands
| Command Name | Source File | Parameters | Returns | Notes |
|---|---|---|---|---|
get_php_status | commands/php.rs | none | ServiceInfo | |
toggle_php | commands/php.rs | none | bool | Currently a stub |
get_php_versions | commands/php.rs | none | PHPVersionInfo[] | |
switch_php_version | commands/php.rs | version: String | bool | Creates php/current junction via cmd |
download_php_version | commands/php.rs | version: String | bool | Streams from windows.php.net; emits php-download-progress events |
list_php_extensions | commands/php.rs | version: String | PHPExtension[] | |
toggle_php_extension | commands/php.rs | version: String, extension: String, enabled: bool | String | |
open_php_terminal | commands/php.rs | version: String | String | Opens Windows Terminal with PHP in PATH |
Log Commands
| Command Name | Source File | Parameters | Returns | Notes |
|---|---|---|---|---|
get_service_logs | commands/logs.rs | service: String | String (log content) | Last N lines of log file |
log_crash_event | commands/logs.rs | service: String, message: String | String |
Config Commands
| Command Name | Source File | Parameters | Returns | Notes |
|---|---|---|---|---|
read_config | commands/config.rs | service: String | String (file content) | |
update_config | commands/config.rs | service: String, content: String | String | |
backup_config | commands/config.rs | service: String | String (backup path) | |
list_config_backups | commands/config.rs | service: String | String[] | |
restore_config_backup | commands/config.rs | service: String, backup_name: String | String |
Terminal Commands
| Command Name | Source File | Parameters | Returns | Notes |
|---|---|---|---|---|
spawn_terminal | commands/terminal.rs | id: String, command: String, args: String[] | String | Starts PTY session |
send_terminal_input | commands/terminal.rs | id: String, input: String | String | |
kill_terminal_session | commands/terminal.rs | id: String | String |
Security Commands
| Command Name | Source File | Parameters | Returns | Notes |
|---|---|---|---|---|
analyze_security | commands/security.rs | none | SecurityReport | Checks config and file permissions |
SSL Commands
| Command | Source | Parameters | Result | Notes |
|---|---|---|---|---|
get_ssl_status | commands/ssl.rs | none | SslStatus | Local trust and HTTPS status |
generate_ssl_cert | commands/ssl.rs | none | String | Provision with mkcert |
enable_ssl | commands/ssl.rs | port: Option<u16> | String | Provision and enable local HTTPS |
trust_ssl_ca | commands/ssl.rs | none | String | Request local CA trust; Windows approval may be needed |
disable_ssl | commands/ssl.rs | none | String | Disable HTTPS |
Virtual Host and Project Commands
Parameters below use Rust names; Tauri callers use camelCase. Failed commands return an error string.
| Command | Source | Parameters | Result |
|---|---|---|---|
list_vhosts | commands/vhosts.rs | none | VhostEntry[] |
add_vhost | commands/vhosts.rs | domain, doc_root; optional https, aliases, project_root, previous_domain | unit |
set_project_php_version | commands/vhosts.rs | project_id, optional version (null inherits default) | unit |
remove_vhost | commands/vhosts.rs | domain | unit; keeps website files |
toggle_vhost | commands/vhosts.rs | domain, enabled | unit |
get_hosts_entries | commands/vhosts.rs | none | String[] |
update_hosts_entry | commands/vhosts.rs | domain, action | String; may require elevation |
get_project_diagnostics | commands/projects.rs | project_id | ProjectDiagnostics |
get_site_configuration_warnings | commands/projects.rs | none | String[] |
suggest_document_root | commands/projects.rs | path | String |
choose_project_folder | commands/projects.rs | none | optional String |
create_project_folder | commands/projects.rs | name | String |
See Projects, PHP & HTTPS for the user workflow and current limitations.
Full Backup Commands
| Command Name | Source File | Parameters | Returns | Notes |
|---|---|---|---|---|
create_full_backup | commands/fullbackup.rs | timestamp: String | FullBackupResult | Includes config/, www/, MySQL dump when running |
list_full_backups | commands/fullbackup.rs | none | BackupEntry[] | Sorted newest-first |
restore_full_backup | commands/fullbackup.rs | path: String | String | Bounded archive preflight, recovery ZIP, server-idle check; partial SQL is possible |
delete_full_backup | commands/fullbackup.rs | path: String | () | Validates path is inside backups/full/ |
cancel_full_backup | commands/fullbackup.rs | none | () | Best-effort cancellation; committed SQL is not rolled back |
list_restore_recovery_records | commands/fullbackup.rs | none | String[] | Read-only retained journal names; never replays SQL or deletes a record |
open_backups_folder | commands/fullbackup.rs | none | String | Opens Explorer at backups dir |
install_app_update (commands/app_update.rs) accepts the update resource rid and progress onEvent channel. It owns the existing database operation lock through installer handoff/restart and requires services to be stopped. Direct frontend updater installation/process-relaunch permissions are disabled; update checks remain available. Windows clients require Windows 10 or newer for atomic Job Object assignment, and fail closed if containment cannot be established.
Shared Rust Types
These structs are serialized to JSON. TypeScript equivalents are in src/types/.
ServiceInfo (Rust) = ServiceStatus (TypeScript)
#[derive(serde::Serialize)]
struct ServiceInfo {
running: bool,
pid: Option<u32>,
port: Option<u16>,
version: Option<String>,
}PHPVersionInfo (Rust) = PHPVersion (TypeScript)
#[derive(serde::Serialize)]
struct PHPVersionInfo {
version: String,
status: String, // "installed" | "available" | "downloading"
path: String,
is_active: bool,
installed: bool,
download_url: String,
}Valid service Parameter Values
Many commands accept a service: String parameter. Valid values:
| Value | Maps to Config File | Notes |
|---|---|---|
"mysql" | %LOCALAPPDATA%\DevStackBox\config\my.cnf | |
"apache" or "httpd" | %LOCALAPPDATA%\DevStackBox\config\httpd.conf | Both accepted |
"php" | %LOCALAPPDATA%\DevStackBox\config\php.ini | |
"phpmyadmin" | %LOCALAPPDATA%\DevStackBox\config\phpmyadmin.conf |
Full generate_handler! Registration (lib.rs)
tauri::generate_handler![
check_binaries,
debug_paths,
debug_installation,
start_all_services,
stop_all_services,
test_apache_config,
test_mysql_config,
get_mysql_status,
get_php_status,
get_apache_status,
start_mysql,
stop_mysql,
start_apache,
stop_apache,
get_php_versions,
switch_php_version,
download_php_version,
list_php_extensions,
toggle_php_extension,
toggle_mysql,
toggle_php,
toggle_apache,
backup_mysql_database,
backup_mysql_database_named,
list_mysql_databases,
list_mysql_databases_detailed,
pick_sql_restore_file,
get_sql_restore_file_info,
restore_mysql_from_file,
apply_php_recommended_import_limits,
list_mysql_users,
create_mysql_user,
drop_mysql_user,
set_mysql_user_password,
open_php_terminal,
get_service_logs,
log_crash_event,
read_config,
update_config,
backup_config,
list_config_backups,
restore_config_backup,
create_directory_structure,
get_autostart,
set_autostart,
get_system_info,
show_main_window,
hide_to_tray,
set_tray_tooltip,
quit_app,
spawn_terminal,
send_terminal_input,
kill_terminal_session,
analyze_security,
get_ssl_status,
generate_ssl_cert,
enable_ssl,
disable_ssl,
list_vhosts,
add_vhost,
remove_vhost,
toggle_vhost,
get_hosts_entries,
update_hosts_entry,
create_full_backup,
list_full_backups,
restore_full_backup,
delete_full_backup,
open_backups_folder,
]Adding a New Command
-
Add the Rust function in the appropriate
commands/module file:#[tauri::command] async fn my_new_command(param: String) -> Result<String, String> { Ok(format!("result: {}", param)) } -
Register it in
run()insidelib.rsundergenerate_handler!. -
Add the constant to
src/lib/commands.ts:export const TAURI_COMMANDS = { someGroup: { myNewCommand: "my_new_command", }, }; -
Call it from the frontend:
const result = await safeInvoke<string>( TAURI_COMMANDS.someGroup.myNewCommand, { param: "value" }, ); -
Update this document with the new command entry.
Unreleased database workspace commands
These commands are part of the v0.1.19 source contract. They are native IPC commands, not a public remote API or shell commands.
| Commands | Purpose |
|---|---|
database_details, database_collations, create_database_with_options | Schema/object metadata and validated creation options |
start_database_operation, database_operations, cancel_database_operation | Native sequential jobs, bounded history and cancellation |
pick_database_files, pick_database_destination, inspect_database_files | Native file selection and risk-review metadata |
database_backups, verify_database_backup, delete_database_backup | Managed backup records, checksum checks and scoped file deletion |
database_grants, set_database_grants | Direct database privilege inspection and explicit additions/removals. The editor supplies the optional expected original grants to reject conflicting changes before applying edits. |
Managed diagnostic logs
read_log_chunk reads a bounded increment using a server-returned cursor; clear: true captures the current end without modifying the file. archive_log verifies a GZIP archive before resetting a stopped-writer log. delete_log_contents requires the reviewed cursor and exact filename confirmation. These commands accept logical IDs, not arbitrary paths.
list_log_archives, read_log_archive, export_log_archive, delete_log_archive and open_log_archives manage recognized diagnostic archives. get_log_policy and set_log_policy control opt-in rotation/retention. run_log_maintenance applies the saved policy and reports deferred or failed operations. These commands never handle MySQL binary/relay/redo/undo logs.
Operations use DevStackBox's verified local MySQL connection. A selected initial database is not confinement for arbitrary imported SQL. Cancellation does not reverse SQL already applied. The grants editor refuses partial-revoke mode rather than changing global restrictions, and escapes database wildcard characters for ordinary database grants.