Component Hierarchy
The frontend follows a clear hierarchical structure:Root Components
App.svelte
The application root - minimal wrapper that renders the mainWindow component:
src/App.svelte
Window.svelte
The main application controller that handles:- Initialization: Loading options, setting up API client
- Routing: Switching between screens based on state
- Updates: Checking for and installing launcher updates
- Error Handling: Global error boundary
src/lib/Window.svelte:92-96
Window.svelte State Management
Window.svelte State Management
src/lib/Window.svelte:13-19
options object includes a store() method for persistence:src/lib/Window.svelte:44-54
Screen Routing
TheWindow component conditionally renders screens:
src/lib/Window.svelte:102-121
Component Structure
src/lib/main/
Contains the primary launcher interface components:Main Screen Components
Main Screen Components
MainScreen.svelte
The primary interface after login. Manages:- Branch and build selection
- Mod management
- Launch process
- Progress tracking
- Log viewing
- Settings
src/lib/main/MainScreen.svelte:- Fetches branches and builds from API
- Handles launch button click
- Listens for progress updates and client output
- Manages running state
LaunchArea.svelte
The central launch control area containing:- Version selector
- Launch button
- Version warnings
VersionSelect.svelte
Dropdown for selecting:- Branch (stable, beta, etc.)
- Specific build
- Release vs. development builds
Account.svelte
Displays current Minecraft account with logout optionMainHeader.svelte
Top bar with:- Logo
- Navigation (News, Settings, Logs)
src/lib/login/
Authentication interface components:Login Components
Login Components
src/lib/settings/
Reusable settings input components:Settings Components
Settings Components
Each setting component follows a consistent pattern:
- RangeSetting.svelte - Slider for numeric values (memory, etc.)
- SelectSetting.svelte - Dropdown for options
- DirectorySelectorSetting.svelte - File system directory picker
- FileSelectorSetting.svelte - File picker
- ButtonSetting.svelte - Clickable action button
- IconButtonSetting.svelte - Icon-based button
- CustomModSetting.svelte - Custom mod management
src/lib/common/
Shared UI components used throughout:- TitleBar.svelte - Window title bar with controls
- ButtonClose.svelte - Close button
- Logo.svelte - LiquidBounce logo
- ToolTip.svelte - Tooltip component
- VerticalFlexWrapper.svelte - Layout helper
- SocialBar.svelte - Social media links
State Management
LiquidLauncher uses Svelte’s built-in reactivity rather than external state management:Reactive Declarations
Props Binding
Two-way binding withbind: directive:
Component Events
Custom events for component communication:Tauri Integration
The frontend communicates with Rust backend via Tauri’s API:Invoking Commands
Listening for Events
System Integration
Other Tauri plugins used:Component Lifecycle
Svelte components have four lifecycle hooks:Styling
Components use scoped CSS:Styles are automatically scoped to the component - they won’t leak to other components.
Best Practices
Use reactive statements (
$:) for derived values rather than manually updating variablesDestructure props at the top of the script block for clarity
Handle async errors - Always wrap
invoke() calls in try-catchClean up listeners - Use
onDestroy() to unsubscribe from eventsBind sparingly - Two-way binding is convenient but can make data flow harder to track
Development Tools
Vite Dev Server
Fast development with hot module replacement:Svelte DevTools
Browser extension for inspecting component hierarchy and state (available for Chrome/Firefox)Console Logging
Svelte preserves your console.log statements:Next Steps
Backend Architecture
Learn about Rust modules and Tauri commands
Launcher Core
Deep dive into the game launch process