Expand description
Main application entry point and orchestration.
§Main Module (Binary)
§RESPONSIBILITIES
Main application orchestration providing entry point, command handlers, lifecycle management, and tray integration for the Mountain desktop application.
This module serves as the primary entry point for the application and coordinates all initialization, execution, and shutdown operations.
§ARCHITECTURAL ROLE
The Main module is the orchestration layer in Mountain’s architecture:
main.rs ──► Binary::Main (Entry::Fn)
│
├─► Entry::Fn() (Main entry point)
├─► IPCCommands (Tauri command handlers)
├─► AppLifecycle (Setup and initialization)
└─► Tray (System tray icon management)§KEY COMPONENTS
- Entry (
Entry::Fn): Main application entry point exported asBinary::Main::Fn() - IPCCommands: All Tauri command handlers for frontend-backend
communication
- Workbench configuration commands
- IPC messaging commands
- Wind desktop configuration commands
- Configuration management commands
- Status reporting commands
- Performance monitoring commands
- Collaboration commands
- Document sync commands
- AppLifecycle: Application lifecycle management and setup
- Tray: System tray icon switching based on theme
§EXPORTS
pub use Entry::Fn as Main: Main entry point- All IPC command functions are exported from IPCCommands
AppLifecycleSetup: Application setup function from AppLifecycleSwitchTrayIcon: Tray icon switching command from Tray
§ERROR HANDLING
- Entry point panics on fatal errors (Tokio runtime, Tauri build)
- IPC commands return
Result<serde_json::Value, String> - Lifecycle setup returns
Result<(), Box<dyn std::error::Error>> - Non-critical failures are logged but don’t prevent operation
§LOGGING
Comprehensive logging throughout with checkpoints at key stages.
Logs use standardized prefixes: [Boot], [Lifecycle], [IPC], [UI].
§PERFORMANCE CONSIDERATIONS
- Async initialization spawned after main setup
- Compile-time resource embedding for tray icons
- Minimal allocation overhead with efficient error handling
§TODO
- Add comprehensive error recovery mechanism
- Implement startup progress indicator
- Add graceful degradation for service failures
- Implement performance metrics collection
Re-exports§
pub use Entry::Fn as Main;
Modules§
- AppLifecycle
- Application lifecycle management.
- Entry
- Main application entry point and orchestration.
- IPCCommands
- IPC command handlers.
- Tray
- System tray commands.