# vishiri/fantasia-archive architecture

> Architecture diagram of the GitHub repository vishiri/fantasia-archive, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/vishiri/fantasia-archive
- Repository: https://github.com/vishiri/fantasia-archive

## Overview

##### Main Components Identification
- Frontend (Presentation/UI Layer):
– Represented by the “src” directory.
– Includes Vue components (in folders like components, layouts, pages) and boot files (e.g., src/boot).
– Also comprises global styles (src/css), internationalization (src/i18n), routing (src/router), and state management (src/stores).

- Electron (Desktop/Backend Layer):
– Represented by the “src-electron” directory.
– Contains the Electron main process file (electron-main.ts) which is responsible for creating the application window.
– Includes the preload script (electron-preload.ts) and strong type definitions (e.g., electron-env.d.ts).
– Features a set of contentBridgeAPIs (under src-electron/contentBridgeAPIs) that manage communication between the renderer (frontend) and the Electron main process.
– Includes additional main scripts (in src-electron/mainScripts) for tasks such as window creation, spell-checking, app management, and platform-specific tweaks.

- Public and Assets:
– The “index.html” file may be used as the base HTML for the app in certain modes.

- Testing Frameworks:
– There are comprehensive tests such as end-to-end (e2e-tests), component tests (located both under src tests folders and e2e-tests), and unit tests (using Vitest).
– Testing files are distributed near their components as well as in global test directories, and these should be clearly marked as auxiliary.

##### Relationships and Interactions
- Data Flow & Communication:
– Boot files (in src/boot) initialize configurations such as axios for data fetching or linking external services, establishing the connection between the UI and external/internal resources.
– The Electron main process (src-electron/electron-main.ts) triggers key events like main window creation and handles application-specific functionalities through mainScripts.

- Architectural Patterns:
– There is clear separation between the Renderer Process (frontend) and the Main Process (backend), characteristic of Electron apps.
– The use of “boot”, “router”, and “store” directories demonstrates an MVC-like separation of concerns in the frontend.
– The project leverages a modular design approach: UI components (and their tests) are isolated in their own directories, while system-level operations are handled by dedicated scripts/APIs.

- External Tooling & Build Systems:
– The Quasar CLI is used for development and production builds, especially with the “electron” mode.
– Yarn is the package manager, and there are configuration files (.editorconfig, .eslintrc, quasar.config.js) that support standardized coding and build practices.

- Don’t simply list directories; group them according to functionality:
▸ Group all Vue-related aspects (components, pages, layouts, boot, router, store) under the Frontend block.
▸ Group all Electron-related files (main, preload, contentBridgeAPIs, mainScripts) under the Desktop Backend block.
▸ Point out that assets provided in “public” and some configurations (like Quasar config and ESLint files) are supporting documents for the overall build and deployment.
– Mark testing infrastructure separately, perhaps with a dedicated “Testing” label that includes Playwright and Vitest tests.

##### Final Advice
- Quasar CLI build process and development mode (hot-code reloading via quasar dev) in a supplementary block if needed for a complete picture.

## Diagram (Mermaid)

```mermaid
flowchart TD

    %% Frontend Layer
    subgraph "Frontend Layer"
        FE_ALL["Vue/Quasar UI"]:::frontend
        FE1["Components"]:::frontend
        FE2["Boot Initialization"]:::frontend
        FE3["Global Styles"]:::frontend
        FE4["Internationalization"]:::frontend
        FE5["Routing"]:::frontend
        FE6["State Management"]:::frontend
        FE_ALL -->|"includes"| FE1
        FE1 -->|"initializes"| FE2
        FE2 -->|"loads"| FE3
        FE3 -->|"configures"| FE4
        FE4 -->|"sets up"| FE5
        FE5 -->|"manages"| FE6
    end

    %% Desktop Backend Layer
    subgraph "Desktop Backend"
        EP1["Electron Main Process"]:::backend
        EP2["Content Bridge APIs"]:::backend
        EP3["Preload Script"]:::backend
        EP_TypeDef1["Env Definitions"]:::backend
        EP_TypeDef2["Flag Definitions"]:::backend
        EP5["Main Scripts"]:::backend
        EP2 -->|"IPC"| EP1
        EP1 -->|"triggers"| EP5
    end

    %% Assets & Public Resources
    subgraph "Assets & Public Resources"
        A1["Public Assets"]:::assets
        A2["Base HTML"]:::assets
        A1 --> A2
    end

    %% Testing Frameworks
    subgraph "Testing Frameworks"
        T1["End-to-End Tests"]:::testing
        T2["Content Bridge APIs Tests"]:::testing
        T3["Main Scripts Tests"]:::testing
        T4["Playwright Config"]:::testing
        T5["Vitest Config"]:::testing
        T1 --> T2
        T2 --> T3
        T3 --> T4
        T4 --> T5
    end

    %% Cross-Layer Communication
    FE2 -->|"API_Call"| EP2
    EP1 -- "Response" --> FE_ALL

    %% Click Events for Frontend Components
    click FE_ALL "https://github.com/vishiri/fantasia-archive/tree/master/src"
    click FE1 "https://github.com/vishiri/fantasia-archive/tree/master/src/components"
    click FE2 "https://github.com/vishiri/fantasia-archive/tree/master/src/boot"
    click FE3 "https://github.com/vishiri/fantasia-archive/tree/master/src/css"
    click FE4 "https://github.com/vishiri/fantasia-archive/tree/master/src/i18n"
    click FE5 "https://github.com/vishiri/fantasia-archive/tree/master/src/router"
    click FE6 "https://github.com/vishiri/fantasia-archive/tree/master/src/stores"

    %% Click Events for Electron Backend Components
    click EP1 "https://github.com/vishiri/fantasia-archive/blob/master/src-electron/electron-main.ts"
    click EP5 "https://github.com/vishiri/fantasia-archive/tree/master/src-electron/mainScripts"
    click EP2 "https://github.com/vishiri/fantasia-archive/tree/master/src-electron/contentBridgeAPIs"
    click EP3 "https://github.com/vishiri/fantasia-archive/blob/master/src-electron/electron-preload.ts"
    click EP_TypeDef1 "https://github.com/vishiri/fantasia-archive/blob/master/src-electron/electron-env.d.ts"
    click EP_TypeDef2 "https://github.com/vishiri/fantasia-archive/blob/master/src-electron/electron-flag.d.ts"

    %% Click Events for Testing Components
    click T1 "https://github.com/vishiri/fantasia-archive/tree/master/e2e-tests"
    click T2 "https://github.com/vishiri/fantasia-archive/tree/master/src-electron/contentBridgeAPIs/tests"
    click T3 "https://github.com/vishiri/fantasia-archive/tree/master/src-electron/mainScripts/tests"
    click T4 "https://github.com/vishiri/fantasia-archive/blob/master/playwright.config.ts"
    click T5 "https://github.com/vishiri/fantasia-archive/blob/master/vitest.config.mts"

    %% Click Events for Assets & Public Resources
    click A1 "https://github.com/vishiri/fantasia-archive/tree/master/public"
    click A2 "https://github.com/vishiri/fantasia-archive/blob/master/index.html"

    %% Styling Classes
    classDef frontend fill:#ADD8E6,stroke:#000,stroke-width:2px;
    classDef backend fill:#90EE90,stroke:#000,stroke-width:2px;
    classDef assets fill:#FFD700,stroke:#000,stroke-width:2px;
    classDef testing fill:#FFA07A,stroke:#000,stroke-width:2px;
```
