# ygtcncakmak/ferdium-app architecture

> Architecture diagram of the GitHub repository ygtcncakmak/ferdium-app, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ygtcncakmak/ferdium-app
- Repository: https://github.com/ygtcncakmak/ferdium-app

## Overview

Based on your provided project file tree and README, Ferdium appears to be a cross‐platform desktop application built with Electron that consolidates multiple web services into one user interface. It is essentially an enhanced fork of Franz (and by extension Ferdi) and includes its own internal server component to handle API requests, translations, and migrations as well as a robust UI built using React (with TypeScript/TSX files), MobX or similar state managers, and a host of custom components and IPC integrations.

- Electron Shell – Represent the Electron “main process” (see the “src/electron” folder) which is responsible for launching the application window(s), setting up IPC (inter‐process communication), deep linking, and handling native functionalities (e.g. tray, menus, notifications).
- Internal Server – Show the “src/internal-server” component that implements an HTTP server (with controllers, routes, models, and migrations) to serve local API endpoints. This module facilitates functions like image handling, recipes, service/user management, and more.
- API Layer – Include the “src/api” modules that abstract various external and internal service calls (e.g. AppApi, UserApi, ServicesApi). This layer interfaces between the UI and external resources, as well as with the internal server.
- Supporting Libraries/Utilities – Illustrate shared modules like “src/lib”, “src/helpers”, and “src/i18n”. For example, the i18n directories manage internationalization, while DBus, Form, and Tray libraries provide utility functions specific to Ferdium.

##### Relationships and interactions
- From the API Layer, illustrate communication with the Internal Server where HTTP-like requests are handled via controllers (depicted in “src/internal-server/app/Controllers”) and responses (with error handlers, migrations, and models).

##### Architectural patterns and design principles
- Separation of Concerns – Distinct divisions between Electron’s main process and the renderer ensure native OS integration is isolated from the UI.
- Modularization – The project is broken up into modules/components (actions, features, stores, recipes, services) that communicate through well-defined channels (API and IPC).
- MVC-like Structure within the Internal Server – Controllers, models, and configurations in “src/internal-server/app” show structured handling of HTTP requests.
- Extensibility – The project’s “recipes”, “features”, and “i18n” directories indicate a design that is intended for modular expansion and localization.

## Diagram (Mermaid)

```mermaid
graph TD
    %% Electron Shell
    subgraph "Electron Shell"
        E_Main("Electron Main Process"):::electron
        E_IPC("IPC API Channels"):::electron
    end

    %% Renderer Process
    subgraph "Renderer Process"
        R_App("App.tsx"):::renderer
        R_Comp("Components"):::renderer
        R_Cont("Containers"):::renderer
        R_Stores("Stores"):::renderer
        R_Feat("Features"):::renderer
    end

    %% API Layer
    subgraph "API Layer"
        API("API Layer (App/User/Services)"):::api
    end

    %% Internal Server
    subgraph "Internal Server"
        IS("Internal Server (HTTP Server)"):::internal
    end

    %% Supporting Libraries/Utilities
    subgraph "Supporting Libraries"
        U_Lib("lib"):::utilities
        U_Help("helpers"):::utilities
        U_I18N("i18n"):::utilities
    end

    %% Build and Configuration
    subgraph "Build & Config"
        B_EB("electron-builder.yml"):::build
        B_Dock("Dockerfile"):::build
        B_GH("Workflows"):::build
    end

    %% Relationships
    E_Main -->|"IPC Channels"| R_App
    E_Main -->|"Manages"| E_IPC

    R_App -->|"API Calls"| API
    API -->|"HTTP Requests"| IS

    %% Renderer internal grouping (for visual grouping only)
    R_App --- R_Comp
    R_Comp --- R_Cont
    R_Cont --- R_Stores
    R_Stores --- R_Feat

    %% Utilities usage
    R_App -->|"Uses"| U_Lib
    R_App -->|"Uses"| U_Help
    API -->|"Uses"| U_I18N

    %% Click Events
    click E_Main "https://github.com/ygtcncakmak/ferdium-app/tree/develop/src/electron"
    click E_IPC "https://github.com/ygtcncakmak/ferdium-app/tree/develop/src/electron/ipc-api"
    click R_App "https://github.com/ygtcncakmak/ferdium-app/blob/develop/src/app.tsx"
    click R_Comp "https://github.com/ygtcncakmak/ferdium-app/tree/develop/src/components"
    click R_Cont "https://github.com/ygtcncakmak/ferdium-app/tree/develop/src/containers"
    click R_Stores "https://github.com/ygtcncakmak/ferdium-app/tree/develop/src/stores"
    click R_Feat "https://github.com/ygtcncakmak/ferdium-app/tree/develop/src/features"
    click API "https://github.com/ygtcncakmak/ferdium-app/tree/develop/src/api"
    click IS "https://github.com/ygtcncakmak/ferdium-app/tree/develop/src/internal-server"
    click U_Lib "https://github.com/ygtcncakmak/ferdium-app/tree/develop/src/lib"
    click U_Help "https://github.com/ygtcncakmak/ferdium-app/tree/develop/src/helpers"
    click U_I18N "https://github.com/ygtcncakmak/ferdium-app/tree/develop/src/i18n"
    click B_EB "https://github.com/ygtcncakmak/ferdium-app/blob/develop/electron-builder.yml"
    click B_Dock "https://github.com/ygtcncakmak/ferdium-app/tree/develop/Dockerfile"
    click B_GH "https://github.com/ygtcncakmak/ferdium-app/tree/develop/.github/workflows"

    %% Styles
    classDef electron fill:#f9c,stroke:#333,stroke-width:2px;
    classDef renderer fill:#cfc,stroke:#333,stroke-width:2px;
    classDef api fill:#ccf,stroke:#333,stroke-width:2px;
    classDef internal fill:#fc9,stroke:#333,stroke-width:2px;
    classDef utilities fill:#cff,stroke:#333,stroke-width:2px;
    classDef build fill:#ffc,stroke:#333,stroke-width:2px;
```
