# coldenate/citationista architecture

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

- Interactive diagram: https://gitdiagram.com/coldenate/citationista
- Repository: https://github.com/coldenate/citationista

## Overview

##### Main Components

a) Core Components:
- RemNote Plugin Interface
- Zotero Integration Service
- Citation Management System
- Export Service

b) Data Flow Components:
- Sync Manager
- Property Hydrator
- Change Detector
- Tree Builder

##### Interface Layer
- RemNote Plugin Interface at the top
- Plugin I/O Service (from src/services/pluginIO.ts)

##### Core Services Layer
- Zotero Integration (src/api/zotero.ts)
- Citation Management (src/services/createLibraryRem.ts)
- Export Service (src/services/exportCitations.ts)

##### Sync Infrastructure Layer
- Sync Manager (src/sync/zoteroSyncManager.ts)
- Change Detector (src/sync/changeDetector.ts)
- Property Hydrator (src/sync/propertyHydrator.ts)
- Tree Builder (src/sync/treeBuilder.ts)

Use the following visual elements:

- Rectangles: Main components
- Rounded rectangles: Services
- Blue: Interface Layer
- Green: Core Services Layer
- Orange: Sync Infrastructure Layer

Key Relationships to Show:

##### Citation Management ↔ Export Service

Specific features:

##### Cache management (src/utils/cache.ts)

Additional Considerations:

##### Data transformation pipeline from Zotero to RemNote format

Important Notes:

- Keep the focus on the core functionality of citation management and Zotero integration
- Plugin's relationship with both RemNote and Zotero
- Clear boundaries between the plugin and external systems
- Utility functions' role in supporting the main components

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles
    classDef interface fill:#a8d1f0,stroke:#000
    classDef core fill:#90EE90,stroke:#000
    classDef sync fill:#FFB347,stroke:#000
    classDef utils fill:#DDA0DD,stroke:#000
    classDef data fill:#F0E68C,stroke:#000

    %% Interface Layer
    subgraph Interface
        Plugin[RemNote Plugin Interface]
        PluginIO[Plugin I/O Service]
        RemNoteAPI[RemNote API Interface]
    end

    %% Core Services Layer
    subgraph CoreServices
        ZoteroInt[Zotero Integration]
        CitationMgmt[Citation Management]
        ExportSvc[Export Service]
        SchemaConv[Schema Conversion]
    end

    %% Sync Infrastructure Layer
    subgraph SyncInfra
        SyncMgr[Sync Manager]
        ChangeDet[Change Detector]
        PropHyd[Property Hydrator]
        TreeBld[Tree Builder]
    end

    %% Utils and Data
    subgraph Utils
        Cache[Cache Management]
        CitFetch[Citation Fetcher]
        ZSchema[Zotero Schema Definitions]
    end

    %% Relationships
    Plugin --> PluginIO
    PluginIO --> RemNoteAPI
    PluginIO --> CoreServices
    
    ZoteroInt --> SyncMgr
    SyncMgr --> ChangeDet
    SyncMgr --> PropHyd
    SyncMgr --> TreeBld
    
    CitationMgmt <--> ExportSvc
    CitationMgmt --> SchemaConv
    SchemaConv --> ZSchema
    
    ZoteroInt <--> CitFetch
    SyncMgr --> Cache
    
    %% Click Events
    click PluginIO "https://github.com/coldenate/citationista/blob/main/src/services/pluginIO.ts"
    click RemNoteAPI "https://github.com/coldenate/citationista/blob/main/src/api/remnote.ts"
    click ZoteroInt "https://github.com/coldenate/citationista/blob/main/src/api/zotero.ts"
    click CitationMgmt "https://github.com/coldenate/citationista/blob/main/src/services/createLibraryRem.ts"
    click ExportSvc "https://github.com/coldenate/citationista/blob/main/src/services/exportCitations.ts"
    click SchemaConv "https://github.com/coldenate/citationista/blob/main/src/services/zoteroSchemaToRemNote.ts"
    click SyncMgr "https://github.com/coldenate/citationista/blob/main/src/sync/zoteroSyncManager.ts"
    click ChangeDet "https://github.com/coldenate/citationista/blob/main/src/sync/changeDetector.ts"
    click PropHyd "https://github.com/coldenate/citationista/blob/main/src/sync/propertyHydrator.ts"
    click TreeBld "https://github.com/coldenate/citationista/blob/main/src/sync/treeBuilder.ts"
    click Cache "https://github.com/coldenate/citationista/blob/main/src/utils/cache.ts"
    click CitFetch "https://github.com/coldenate/citationista/blob/main/src/utils/fetchCitation.ts"
    click ZSchema "https://github.com/coldenate/citationista/blob/main/src/constants/zoteroItemSchema.ts"

    %% Styling
    class Plugin,PluginIO,RemNoteAPI interface
    class ZoteroInt,CitationMgmt,ExportSvc,SchemaConv core
    class SyncMgr,ChangeDet,PropHyd,TreeBld sync
    class Cache,CitFetch,ZSchema utils
```
