How riffcc/flagship works
And Lay Out the Main Components
a. Electron Main Process:
• Location: packages/main
• Key files: index.ts, constellation.ts, http.ts, mainWindow.ts, security-restrictions.ts, systèmeFichiers.ts
• Role: Initializes Electron, creates windows, manages security restrictions, and sets up the application environment.
b. Preload Scripts:
• Location: packages/preload
• Key files: index.ts, http.ts, so.ts, systèmeFichiers.ts
• Role: Acts as a secure bridge between the Electron main process and the renderer. It exposes limited APIs to the renderer for controlled communication.
c. Renderer (User Interface):
• Location: packages/renderer
• Key files: indexBrowser.html, indexElectron.html, index.ts, multiple Vue component files and views under src/
• Role: Provides the front-end UI using Vue. It handles user interactions, displays application pages (account, admin, home, upload, etc.), and leverages plugins (like Constellation and Inscription) and composables to manage state and features.
d. External Services and Components:
• Decentralized/Distributed data handling using OrbitDB, Constellation, and IPFS.
• Moderation Database: As described in installation instructions (copying the VITE_SITE_ID from the app startup).
• APIs / HTTP communications that are set up in several modules (see http.ts in both main and preload).
e. Build, Configuration & Testing:
• Build Tools: Vite (configured in each package), Electron Builder (electron-builder.config.cjs), and various configuration files for ESLint, Prettier, etc.
• Testing and CI: GitHub Actions workflows (in .github/workflows/) and testing directories (packages/*/tests, tests/e2e.spec.ts, vitest.config.js).
Interactions & Data Flow
• Communication Flow:
– The Main process, which sets up the Electron windows, handles business logic and integration with external services, then sends responses back in a similar secure fashion.
• External Data:
– Show how external services (OrbitDB, IPFS, Constellation, moderation database via HTTP) interact with the Main process to fetch or store data.
– Indicate dependencies on Node.JS and external libraries as described in the installation instructions.
Architectural Patterns and Design Principles
• Separation of Concerns:
– Distinct layers are clear: Main, Preload, and Renderer. This separation helps with both security and maintainability.
– Use of Vue Single-File Components (SFCs) in the Renderer for UI logic.
• Secure Bridge:
– Preload scripts are used to isolate the untrusted Renderer code from sensitive operations in the Main process.
• Modular Organization:
– The project is divided into packages (main, preload, renderer) and further into logically separated folders (components, views, plugins, composables) which facilitates scalability and potential microservice-like modularization if the platform grows further.
• Development Pipeline:
Final Advice
• Pay special attention to the separation between web (browser) and Electron (desktop) approaches: note that there is an indexBrowser.html for standard web execution and indexElectron.html for desktop deployment.