How kontains/selectron works
Main System Components
a) Core Runtime Layer (Rust)
• Main Rust components from /src:
• backend.rs
• frontend.rs
• ipcchannel.rs
• main.rs
b) API Emulation Layer (Middle)
Three main API groups:
• Electron APIs (/src/electron)
• Node APIs (/src/node)
• Common APIs (/src/common)
c) WebView Layer (Top)
Two distinct WebView containers:
• NodeJS Backend WebView
• Electron Frontend WebView(s)
Component Relationships
• IPC channel connections between Frontend and Backend WebViews
Special Architectural Elements
Key features:
• XMLHttpRequest Communication System
• Native Browser Dev-Tools Integration
• Cross-Platform WebView Implementation
Implementation Details
Create subsections showing:
a) API Implementation Structure:
• Electron APIs (dialog, menu, etc.)
• Node APIs (fs, child_process, crypto, etc.)
• Addons (pty, spdlog, sqlite)
b) JavaScript Bridge:
• How /src/js connects frontend and backend
• Shared components in /src/js/shared
Technical Notes
Annotations for:
• Cross-platform compatibility
• Debug mode vs. Release mode
• API emulation strategy
• WebView isolation
The isolation of frontend and backend WebViews
Keep the abstraction level focused on the architectural components while showing enough detail to understand the unique approach of using Rust to emulate Electron/Node APIs through WebViews.
Remember to include a note about the build size optimization (10MB) and cross-platform nature of the application, as these are key architectural achievements of the system.