# galateapolymorph/fanslib architecture

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

- Interactive diagram: https://gitdiagram.com/galateapolymorph/fanslib
- Repository: https://github.com/galateapolymorph/fanslib

## Overview

##### Main Architectural Components

a) Electron Application Layer
- Main Process
- Renderer Process
- IPC Communication Layer

b) Feature Modules
- Library Management
- Content Scheduling
- Post Management
- Channel Management
- Settings Management

c) Data Layer
- Local Database
- File System Integration

##### Component Relationships

**[Electron Main Process] ←→ [IPC Bridge] ←→ [Renderer Process (React UI)]**
- ↕                                           ↕
**[System Integration]                        [Feature Modules]**
**(File System, Media)                              ↕**
- ↕                                  [Data Layer]
**[Local Media Library] ←→ [Local Database]**

##### Specific Implementation Details

- The separation between main and renderer processes
- How the IPC registry manages communication
- The relationship between media files and the database
- How features interact with both the UI and data layer

##### Data Flow Indicators

Key flows:
- Media file scanning and indexing
- Post scheduling and management
- Content organization (categories, tags, shoots)
- Settings persistence
- Thumbnail generation and caching

##### Technical Stack Indicators

Technologies:
- Electron
- React
- TypeScript
- Local File System
- Custom Protocols (media-protocol, thumbnail-protocol)

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Electron
        MP["Main Process"]
        RP["Renderer Process"]
        IPC["IPC Communication Layer"]
        
        MP <--> IPC
        IPC <--> RP
    end

    subgraph "Feature Modules"
        LM["Library Management"]
        CS["Content Scheduling"]
        PM["Post Management"]
        CM["Channel Management"]
        SM["Settings Management"]
        CAT["Category Management"]
        TM["Tags Management"]
        SHM["Shoots Management"]
    end

    subgraph "Data Layer"
        DB[(Local Database)]
        FSI["File System Integration"]
        MH["Media Handling"]
    end

    subgraph "Protocol Handlers"
        MPH["Media Protocol"]
        TPH["Thumbnail Protocol"]
        STM["Stream Management"]
    end

    subgraph "Frontend Components"
        RC["React Components"]
        CP["Context Providers"]
        PC["Page Components"]
        UI["UI Component Library"]
    end

    MP --> MPH & TPH & STM
    RP --> RC & CP & PC & UI
    IPC --> LM & CS & PM & CM & SM & CAT & TM & SHM
    LM & CS & PM & CM & SM & CAT & TM & SHM --> DB
    FSI --> DB
    MH --> FSI

    classDef main fill:#2196F3,color:white
    classDef feature fill:#4CAF50,color:white
    classDef data fill:#FF9800,color:white
    classDef ui fill:#9C27B0,color:white
    classDef protocol fill:#607D8B,color:white

    class MP,RP,IPC main
    class LM,CS,PM,CM,SM,CAT,TM,SHM feature
    class DB,FSI,MH data
    class RC,CP,PC,UI ui
    class MPH,TPH,STM protocol

    click MP "https://github.com/GalateaPolymorph/fanslib/blob/main/src/main/index.ts"
    click IPC "https://github.com/GalateaPolymorph/fanslib/blob/main/src/main/IpcRegistry.ts"
    click RP "https://github.com/GalateaPolymorph/fanslib/blob/main/src/renderer/src/main.tsx"
    click LM "https://github.com/GalateaPolymorph/fanslib/tree/main/src/features/library/"
    click CS "https://github.com/GalateaPolymorph/fanslib/tree/main/src/features/content-schedules/"
    click PM "https://github.com/GalateaPolymorph/fanslib/tree/main/src/features/posts/"
    click CM "https://github.com/GalateaPolymorph/fanslib/tree/main/src/features/channels/"
    click SM "https://github.com/GalateaPolymorph/fanslib/tree/main/src/features/settings/"
    click DB "https://github.com/GalateaPolymorph/fanslib/blob/main/src/lib/db.ts"
    click FSI "https://github.com/GalateaPolymorph/fanslib/blob/main/src/lib/walkDirectory.ts"
    click MPH "https://github.com/GalateaPolymorph/fanslib/blob/main/src/main/media-protocol.ts"
    click TPH "https://github.com/GalateaPolymorph/fanslib/blob/main/src/main/thumbnail-protocol.ts"
    click STM "https://github.com/GalateaPolymorph/fanslib/blob/main/src/main/stream.ts"
    click RC "https://github.com/GalateaPolymorph/fanslib/tree/main/src/renderer/src/components/"
    click CP "https://github.com/GalateaPolymorph/fanslib/tree/main/src/renderer/src/contexts/"
    click PC "https://github.com/GalateaPolymorph/fanslib/tree/main/src/renderer/src/pages/"
    click UI "https://github.com/GalateaPolymorph/fanslib/tree/main/src/renderer/src/components/ui/"
    click MH "https://github.com/GalateaPolymorph/fanslib/blob/main/src/lib/video.ts"
    click CAT "https://github.com/GalateaPolymorph/fanslib/tree/main/src/features/categories/"
    click TM "https://github.com/GalateaPolymorph/fanslib/tree/main/src/features/tags/"
    click SHM "https://github.com/GalateaPolymorph/fanslib/tree/main/src/features/shoots/"
```
