# codfisher/side-project-cod-toys architecture

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

- Interactive diagram: https://gitdiagram.com/codfisher/side-project-cod-toys
- Repository: https://github.com/codfisher/side-project-cod-toys

## Overview

##### Main Components

a. Electron Layer
- Main Process (from electron/main.ts)
- Preload Scripts (from electron/preload.ts)
- IPC Communication Channels

b. Frontend Application (Vue.js Based)
- Core Application Layer
- App Root (App.vue)
- Router System (implied by typed-router.d.ts)
- Store System (stores directory)
- i18n System (locales directory)

c. Feature Modules
- Google Card Feature
- Kaomoji Feature
- Configuration System

##### Architecture Patterns to Highlight

a. Component Organization
- Base Components (/components)
- Domain-specific Components (/domains)
- Pages (/pages)
- Composables (/composables)

b. State Management
- Pinia store architecture (stores directory)
- Data flow between stores and components

##### Layer Organization (Top to Bottom)

**[Electron Main Process]**
- ↕
**[Preload Bridge]**
- ↕
**[Vue.js Application]**
- ↙   ↓   ↘
**[Features][Core Services][UI Components]**

##### Important Elements

a. Core Services Layer:
- API Service (src/common/api.ts)
- i18n Service (src/locales)
- Configuration API (src/composables/use-config-api.ts)
- Main API (src/composables/use-main-api.ts)

b. Feature Modules:
- Google Card Feature
- Kaomoji Feature with its configuration

c. Cross-Cutting Concerns:
- Type System (src/types)
- Utilities (src/common)
- Style System (src/style)

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Electron
        MainProcess["Main Process"]:::electron
        PreloadScripts["Preload Scripts"]:::electron
        ElectronTypes["Electron Types"]:::electron
        
        MainProcess <--> PreloadScripts
        PreloadScripts --> ElectronTypes
    end

    subgraph Frontend
        AppRoot["App Root"]:::vue
        Router["Router System"]:::vue
        i18nSystem["i18n System"]:::service
        
        AppRoot --> Router
        AppRoot --> i18nSystem
    end

    subgraph CoreServices
        APIService["API Service"]:::service
        ConfigAPI["Configuration API"]:::service
        MainAPI["Main API"]:::service
        LangService["Language Service"]:::service
        
        APIService --> ConfigAPI
        APIService --> MainAPI
        i18nSystem --> LangService
    end

    subgraph Features
        GoogleCard["Google Card Feature"]:::feature
        KaomojiFeature["Kaomoji Feature"]:::feature
        KaomojiConfig["Kaomoji Configuration"]:::feature
        
        KaomojiFeature --> KaomojiConfig
    end

    subgraph StateManagement
        FeatureStore["Feature Store"]:::store
    end

    subgraph CrossCutting
        TypeSystem["Type System"]:::util
        Utils["Utilities"]:::util
        StyleSystem["Style System"]:::util
        ComponentBase["Component Base"]:::util
    end

    subgraph UILayer
        BaseComponents["Base Components"]:::ui
        DomainComponents["Domain Components"]:::ui
        Pages["Pages"]:::ui
    end

    PreloadScripts -.-> APIService
    APIService --> FeatureStore
    FeatureStore --> Features
    Features --> UILayer
    CrossCutting --> UILayer
    
    %% Click Events
    click MainProcess "https://github.com/Codfisher/side-project-cod-toys/blob/main/electron/main.ts"
    click PreloadScripts "https://github.com/Codfisher/side-project-cod-toys/blob/main/electron/preload.ts"
    click ElectronTypes "https://github.com/Codfisher/side-project-cod-toys/blob/main/electron/electron-env.d.ts"
    click AppRoot "https://github.com/Codfisher/side-project-cod-toys/blob/main/src/App.vue"
    click Router "https://github.com/Codfisher/side-project-cod-toys/blob/main/typed-router.d.ts"
    click i18nSystem "https://github.com/Codfisher/side-project-cod-toys/blob/main/src/locales/i18n.ts"
    click APIService "https://github.com/Codfisher/side-project-cod-toys/blob/main/src/common/api.ts"
    click ConfigAPI "https://github.com/Codfisher/side-project-cod-toys/blob/main/src/composables/use-config-api.ts"
    click MainAPI "https://github.com/Codfisher/side-project-cod-toys/blob/main/src/composables/use-main-api.ts"
    click LangService "https://github.com/Codfisher/side-project-cod-toys/blob/main/src/composables/use-lang.ts"
    click GoogleCard "https://github.com/Codfisher/side-project-cod-toys/blob/main/src/domains/feature-card-google/index.vue"
    click KaomojiFeature "https://github.com/Codfisher/side-project-cod-toys/blob/main/src/domains/feature-card-kaomoji/index.vue"
    click KaomojiConfig "https://github.com/Codfisher/side-project-cod-toys/blob/main/src/pages/kaomoji-config/index.vue"
    click TypeSystem "https://github.com/Codfisher/side-project-cod-toys/tree/main/src/types"
    click Utils "https://github.com/Codfisher/side-project-cod-toys/blob/main/src/common/utils.ts"
    click StyleSystem "https://github.com/Codfisher/side-project-cod-toys/tree/main/src/style"
    click ComponentBase "https://github.com/Codfisher/side-project-cod-toys/tree/main/src/components"
    click FeatureStore "https://github.com/Codfisher/side-project-cod-toys/blob/main/src/stores/feature.store.ts"
    click BaseComponents "https://github.com/Codfisher/side-project-cod-toys/tree/main/src/components"
    click DomainComponents "https://github.com/Codfisher/side-project-cod-toys/tree/main/src/domains"
    click Pages "https://github.com/Codfisher/side-project-cod-toys/tree/main/src/pages"

    %% Styles
    classDef electron fill:#3498db,stroke:#2980b9,color:white
    classDef vue fill:#42b883,stroke:#2c3e50,color:white
    classDef service fill:#f1c40f,stroke:#f39c12,color:black
    classDef feature fill:#e67e22,stroke:#d35400,color:white
    classDef store fill:#9b59b6,stroke:#8e44ad,color:white
    classDef util fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef ui fill:#2ecc71,stroke:#27ae60,color:white

    %% Legend
    subgraph Legend
        L1["Electron Components"]:::electron
        L2["Vue Components"]:::vue
        L3["Services"]:::service
        L4["Features"]:::feature
        L5["State Management"]:::store
        L6["Utilities"]:::util
        L7["UI Components"]:::ui
    end
```
