How tahirdibirovsoftware/orion-ground-station-gui works
Main Components
• Electron Main Process: Located in the src/main directory, it manages backend tasks such as database configuration, port management (handling flight ports and IoT ports), HTTP configurations, and workers (e.g., network.worker.ts). This is the “brain” of the application, managing system-level processes.
• Preload Scripts: Found in src/preload, these scripts act as a secure bridge between the Electron main process and the renderer process, ensuring controlled API communications.
• Renderer Process (UI Layer): This is the frontend of the application and is built with React. The src/renderer directory contains the entry point (index.html, main.tsx) along with a rich hierarchical structure that includes:
• Entities (e.g., AltDiff, BarChart, Cam, Map, etc.) representing various interactive UI components possibly corresponding to different aspects of the ground station (charts, telemetry, satellite status, etc.).
• Features (e.g., PortConfig, Connector, LangToggler, MenuToggler, etc.) which encapsulate specific functionalities or state management (often via Redux slices).
• Widgets (e.g., Header, Footer, Terminal, StatusBar, etc.) that offer additional UI utilities and controls.
• Build and Configuration Components: Files such as electron-builder.yml, electron.vite.config.ts, and various ESLint/Prettier settings highlight how the project is configured and deployed (using Electron Builder for packaging and deployment).
Relationships and Interactions
• The Main Process communicates with hardware and system resources (serial/IoT ports, database) and manages background operations.
• Preload scripts provide a secure conduit for data exchange between the main process and the React-based renderer, leveraging Electron’s IPC (inter-process communication) mechanism.
• The Renderer process provides the user interface with a clear separation of concerns. Its subdirectories (entities, features, widgets) interact with each other using state management (e.g., Redux) and API calls, and they receive data from the main process via the preload bridge.
Architectural Patterns & Design Principles
• Separation of Concerns: There is a clear delineation between the backend (Electron main), intermediary (preload), and frontend (renderer). This improves maintainability and security.
• Modular Design: The extensive use of directories for features, entities, and widgets indicates a modular component-based approach, making the UI highly scalable and testable.
• Use of IPC: Electron’s inter-process communication is central to the interaction between the main and renderer processes.
• Layered Architecture: The design separates core business logic (inside the main process) from presentation/UI logic (inside the renderer), and configuration/load handling via the preload layer.
Final Reminders
• Make it modular: Separate out the high-level sections (main, preload, renderer) and then drill down into finer details (UI components, business logic modules, configuration sections).
• Keep it updated: Reflect any future changes in the folder structure or additional components/modules if the project evolves.