# rmzelle/ref-extractor architecture

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

- Interactive diagram: https://gitdiagram.com/rmzelle/ref-extractor
- Repository: https://github.com/rmzelle/ref-extractor

## Overview

##### Main Components

a. Client-Side Application
- Browser Environment (primary runtime)
- File Input Handler
- Document Parser
- Reference Extractor Core
- Format Converter
- Output Generator
- User Interface Layer

b. External Dependencies
- Citation.js Library
- Zotero Integration
- Mendeley Integration

##### Data transformation steps

- File Upload Interface
- Document Parser (for .docx and .odt)
- Reference Extraction Engine
- Format Converter
- Output Generator
- UI Components

- Zotero
- Mendeley
- Citation.js

- Document → Parser
- Parser → Reference Extractor
- Reference Extractor → Format Converter
- Format Converter → Output Generator

D. Output Formats (use parallelograms):
- CSL JSON
- BibTeX
- RIS
- APA Bibliography

- Blue: Core processing components
- Green: Input/Output interfaces
- Orange: External systems
- Grey: Data formats

Important Architectural Considerations:

##### Client-Side Processing
- That all processing happens locally (privacy feature)
- Clear boundaries of browser environment

##### Integration Points
- How the system interfaces with Zotero and Mendeley
- Citation.js library integration

##### Data Flow
- Document the transformation pipeline
- Format conversion paths

Special Notes:

##### Privacy-First Design
- A note that all processing occurs client-side
- No server communication required

##### Format Handling
- Supported input formats (.docx, .odt)
- Possible output formats

##### Browser Integration
- Browser API dependencies
- File system interaction points

Level of Detail:

- Major components
- Data flow directions
- Format transformations
- Integration points
- Security boundaries

Remember to include a notes section explaining:
- Privacy-first architecture
- Browser-based limitations
- Format conversion fidelity
- Integration requirements

This will provide a comprehensive view of the system while maintaining clarity about its browser-based, privacy-focused nature.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Browser["Browser Environment"]
        direction TB
        UI[User Interface]
        FileInput[File Input Handler]
        DocParser[Document Parser]
        RefExtractor[Reference Extractor Core]
        FormatConv[Format Converter]
        OutputGen[Output Generator]
        
        FileInput --> DocParser
        DocParser --> RefExtractor
        RefExtractor --> FormatConv
        FormatConv --> OutputGen
        UI --> FileInput
        OutputGen --> UI
    end

    subgraph ExternalSys["External Systems"]
        direction TB
        Zotero[Zotero Integration]
        Mendeley[Mendeley Integration]
        CitationJS[Citation.js Library]
    end

    subgraph InputFormats["Input Formats"]
        DOCX[".docx"]
        ODT[".odt"]
    end

    subgraph OutputFormats["Output Formats"]
        CSL["CSL JSON"]
        BibTeX["BibTeX"]
        RIS["RIS"]
        APA["APA Bibliography"]
    end

    DOCX --> FileInput
    ODT --> FileInput
    
    RefExtractor --> CitationJS
    RefExtractor --> Zotero
    RefExtractor --> Mendeley
    
    OutputGen --> CSL
    OutputGen --> BibTeX
    OutputGen --> RIS
    OutputGen --> APA

    click UI "https://github.com/rmzelle/ref-extractor/blob/master/index.html"
    click UI "https://github.com/rmzelle/ref-extractor/blob/master/css/sticky-footer-navbar.css"
    click RefExtractor "https://github.com/rmzelle/ref-extractor/blob/master/libraries/ref-extractor.js"
    click DocParser "https://github.com/rmzelle/ref-extractor/blob/master/libraries/ref-extractor.js"
    click FormatConv "https://github.com/rmzelle/ref-extractor/blob/master/libraries/ref-extractor.js"
    click OutputGen "https://github.com/rmzelle/ref-extractor/blob/master/libraries/ref-extractor.js"
    click FileInput "https://github.com/rmzelle/ref-extractor/blob/master/libraries/ref-extractor.js"

    classDef core fill:#2374ab
    classDef external fill:#ff7f50
    classDef format fill:#95a5a6
    classDef browser fill:#ecf0f1,stroke:#34495e,stroke-width:2px
    
    class UI,FileInput,DocParser,RefExtractor,FormatConv,OutputGen core
    class Zotero,Mendeley,CitationJS external
    class DOCX,ODT,CSL,BibTeX,RIS,APA format
    class Browser browser

    %% Legend
    subgraph Legend
        CoreComp[Core Components]:::core
        ExtSys[External Systems]:::external
        DataFormat[Data Formats]:::format
    end
```
