How milkshiift/goofcord works
Project Type and Purpose
• Project Type: GoofCord is a standalone Discord client with privacy enhancements and customization options. It leverages plugins & themes support and is built using Electron.
• Purpose: It modernizes Discord’s interface, blocking tracking, enabling encryption, and supporting mod integrations (such as Vencord and Shelter) to offer a tailored, secure experience.
File Structure
• Top-level organization:
• “assets”: Contains front-end resources such as JavaScript for ad blockers, custom CSS files for Discord themed modifications, HTML for settings and dropdowns, and language files (i.e., localization JSON files).
• “assetsDev”: Includes development assets (like test language generation, meta information XML, language codes) that support development tasks.
• “src”: Houses all core source code including configuration files (config.ts, settingsSchema.ts), the Electron main process (main.ts), IPC generation and loader scripts, and modularized functionalities.
• “src/windows”: Contains code for various windows in the app:
• “main”: Main window logic, including preload scripts and bridge functionality.
• “screenshare”: Dedicated screensharing window with its main script and preload.
• “settings”: Handles settings rendering, cloud settings, and encryption related to settings.
• Other key files:
• Electron-specific files (electron-builder.ts) indicate packaging with Electron Builder.
• Package management files (package.json, bun.lock, tsconfig.json) show usage of Node.js/Bun.
• Configuration files such as biome.json suggest additional packaging or runtime configuration.
Insights from the README
• The README emphasizes the client’s features (privacy, performance, standalone nature) and describes practical packaging instructions for Windows, Linux, and macOS.
• It details how to compile the application using Node.js and Bun, giving insights about dependencies and build steps.
• Links to various external projects (LegCord, Vencord, Shelter) indicate integration points and inspiration for extensibility.
a. Main Components:
• Electron Main Process: Central entry point (src/main.ts) that initializes the app, loads modules, and manages windows.
• UI Windows: Each with its own directory under src/windows (main window, screenshare window, settings window). These use preload scripts (preload.mts) to safely expose APIs.
• Modules Layer: Under src/modules, each module handles a specific functionality like encryption (messageEncryption.ts), update checks (updateCheck.ts), caching (cacheManager.ts) or firewall controls.
• Assets and Localization: Resources from assets/ (CSS, fonts, HTML) and assets/lang (JSON) supporting UI styling and multi-language support.
• Configuration & IPC: Config files in src/config.ts and IPC generation in src/ipcGen.ts vital for internal communications between processes.
b. Relationships and Interactions:
• The main Electron process spawns and manages UI windows, routing through preload scripts for safe API communications.
• Modules are invoked by the main process as well as by UI handlers to provide functionalities (for instance, mod support or encryption).
• Assets are loaded into the windows for UI presentation with their associated CSS/HTML and language JSON files enabling localization.
• Build scripts gather sources from src and assets to package final binaries using Electron Builder integrations.
• External integrations (plugins & themes) tap into defined extension points provided by modules.
c. Architectural Patterns and Design Principles:
• Modular Architecture: Separates core functionalities into individual modules (e.g., assetLoader, cacheManager), which makes the codebase both maintainable and extensible.
• Layered Design: Clearly distinguishes between backend logic (main process and modules) and frontend user interface (windows and assets).
• IPC Communication: Use of preload scripts to mediate secure interactions between renderer processes and the main process.
• Platform Abstraction: Build scripts and platform-specific install packages handle differences among Windows, Linux, and macOS.
d. Relevant Technologies, Frameworks, and Libraries:
• Electron: Underpins the desktop application architecture by managing processes and windows.
• Node.js & Bun: For package management, script execution, and build automation.
• TypeScript: The majority of the project files are written in TypeScript, ensuring type safety and structured development.
• CSS/HTML: Utilized in asset management to provide the custom user interface.
• Localization: JSON language files support multi-language functionalities.