# bloombooks/bloomdesktop architecture

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

- Interactive diagram: https://gitdiagram.com/bloombooks/bloomdesktop
- Repository: https://github.com/bloombooks/bloomdesktop

## Overview

##### Main Components Overview

a) Frontend Layer:
- React-based UI components (BloomBrowserUI directory)
- Web views for document editing
- Browser-based tools and editors
- Style and theme management

b) Backend Layer:
- C# WinForms application (BloomExe directory)
- WebView2 PDF maker component
- File system management
- Book processing engine

c) External Services:
- Crowdin integration for localization
- TeamCity build system
- YouTrack for issue tracking
- S3 for storage
- BloomLibrary.org integration

##### Key Architectural Patterns to Highlight

a) Hybrid Architecture:
- Bridge between C# backend and web frontend
- WebSocket communication channels
- API controllers for frontend-backend interaction

b) Book Processing Pipeline:
- Template system
- Content processing
- PDF generation
- Export formats (ePub, PDF, BloomPub)

c) Plugin System:
- XMatter templates
- Branding packages
- Custom templates

##### Data Flow Representation

- User input → UI components → Backend processing
- Template selection → Book creation → Output generation
- File system operations
- External service interactions

##### Component Details

a) Frontend Components:
- Page editors
- Toolbox
- Collection management
- Publishing tools
- Style editors

b) Backend Services:
- Book storage
- Image processing
- Font management
- PDF generation
- File compression

c) Integration Points:
- URL handlers (bloom:// protocol)
- External tool integration
- Cloud services connection

##### Important Subsystems

Specialized subsystems:
- Localization management
- Template processing
- Book compilation
- Publishing pipeline
- Team collection features

##### Development Environment

A section showing:
- Build pipeline
- Development tools
- Testing framework
- Continuous integration

## Diagram (Mermaid)

```mermaid
graph TB
    %% Main Layers
    subgraph Frontend
        UI[React Frontend UI]
        BookEdit[Book Editor Interface]
        Publish[Publishing System]
        StyleEditor[Style Editor]
        Toolbox[Toolbox]
    end

    subgraph Backend
        Core[C# Backend Core]
        PDFMaker[PDF Generation]
        BookEngine[Book Processing Engine]
        WebServer[Web Server Components]
        Templates[Template System]
        Branding[Branding System]
        Localization[Localization System]
        Collections[Collection Management]
        Team[Team Collaboration]
        Fonts[Font Processing]
        ErrorReport[Error Reporting]
    end

    subgraph ExternalServices
        Crowdin[Crowdin Translation]
        TeamCity[TeamCity Build]
        YouTrack[YouTrack Issues]
        S3[S3 Storage]
        BloomLib[BloomLibrary.org]
    end

    %% Connections
    UI --> BookEdit
    UI --> Publish
    UI --> StyleEditor
    UI --> Toolbox
    
    BookEdit --> WebServer
    Publish --> WebServer
    StyleEditor --> WebServer
    Toolbox --> WebServer
    
    WebServer --> Core
    Core --> BookEngine
    Core --> PDFMaker
    Core --> Collections
    Core --> Team
    Core --> ErrorReport
    Core --> Fonts
    
    BookEngine --> Templates
    BookEngine --> Branding
    BookEngine --> Localization
    
    Core --> BloomLib
    Core --> S3
    Localization --> Crowdin
    ErrorReport --> YouTrack
    Core --> TeamCity

    %% Styling
    classDef frontend fill:#f9a,stroke:#333,stroke-width:2px
    classDef backend fill:#adf,stroke:#333,stroke-width:2px
    classDef external fill:#9f9,stroke:#333,stroke-width:2px
    
    class UI,BookEdit,Publish,StyleEditor,Toolbox frontend
    class Core,PDFMaker,BookEngine,WebServer,Templates,Branding,Localization,Collections,Team,Fonts,ErrorReport backend
    class Crowdin,TeamCity,YouTrack,S3,BloomLib external

    %% Click Events
    click UI "https://github.com/BloomBooks/BloomDesktop/tree/master/src/BloomBrowserUI/"
    click BookEdit "https://github.com/BloomBooks/BloomDesktop/tree/master/src/BloomBrowserUI/bookEdit/"
    click Publish "https://github.com/BloomBooks/BloomDesktop/tree/master/src/BloomBrowserUI/publish/"
    click Core "https://github.com/BloomBooks/BloomDesktop/tree/master/src/BloomExe/"
    click PDFMaker "https://github.com/BloomBooks/BloomDesktop/tree/master/src/WebView2PdfMaker/"
    click BookEngine "https://github.com/BloomBooks/BloomDesktop/tree/master/src/BloomExe/Book/"
    click WebServer "https://github.com/BloomBooks/BloomDesktop/tree/master/src/BloomExe/web/"
    click Templates "https://github.com/BloomBooks/BloomDesktop/tree/master/src/content/templates/"
    click Branding "https://github.com/BloomBooks/BloomDesktop/tree/master/src/content/branding/"
    click Localization "https://github.com/BloomBooks/BloomDesktop/tree/master/DistFiles/localization/"
    click BloomLib "https://github.com/BloomBooks/BloomDesktop/tree/master/src/BloomExe/WebLibraryIntegration/"
    click Collections "https://github.com/BloomBooks/BloomDesktop/tree/master/src/BloomExe/Collection/"
    click Team "https://github.com/BloomBooks/BloomDesktop/tree/master/src/BloomExe/TeamCollection/"
    click ErrorReport "https://github.com/BloomBooks/BloomDesktop/tree/master/src/BloomExe/ErrorReporter/"
    click Fonts "https://github.com/BloomBooks/BloomDesktop/tree/master/src/BloomExe/FontProcessing/"
```
