# ranchero-software/netnewswire architecture

> Architecture diagram of the GitHub repository ranchero-software/netnewswire, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ranchero-software/netnewswire
- Repository: https://github.com/ranchero-software/netnewswire

## Overview

##### Main Components Overview
The system should be divided into these major components:

a) Core Components:
- Account Management System
- Article Processing System
- Feed Management System
- Database Layer
- Sync System

b) Platform-Specific UI Components:
- macOS Interface
- iOS Interface
- Widget System
- Share Extensions

##### Key Architectural Elements

a) Data Layer:
- Articles Database (ArticlesDatabase/)
- Sync Database (SyncDatabase/)
- Account Management (Account/)
- Feed Parser (Parser/)

b) Service Integration Layer:
- CloudKit Integration
- Feedbin Integration
- NewsBlur Integration
- Feedly Integration
- Reader API Support

c) UI Components:
- Timeline Views
- Article Views
- Sidebar Navigation
- Inspector Views
- Preferences/Settings

**[UI Layer]**
- ↑
**[Business Logic Layer]**
- ↑
**[Service Integration Layer]**
- ↑
**[Data Layer]**

##### Important Relationships

a) Data Flow:
- Feed parsing → Article storage
- Account sync → Local database
- Article status updates → Sync service

b) Dependencies:
- RSCore utility functions
- RSWeb networking
- RSTree data structure
- RSDatabase storage

##### Specific Implementation Details

Key architectural patterns:
- Model-View-Controller pattern for UI
- Protocol-oriented design for account management
- Operation queue-based sync system
- Extension-based sharing system

##### Integration Points

External service connections:
- iCloud/CloudKit
- Third-party feed services
- Safari extension
- Share extension
- Widget extension

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph UI
        direction TB
        MAC["macOS Interface"]
        IOS["iOS Interface"]
        WID["Widget System"]
        SHR["Share Extensions"]
        
        TML["Timeline View"]:::ui
        ART["Article View"]:::ui
        SBR["Sidebar"]:::ui
        INS["Inspector"]:::ui
        
        MAC --> TML & ART & SBR & INS
    end
    
    subgraph BL["Business Logic"]
        direction TB
        AMS["Account Manager"]:::core
        APS["Article Processing"]:::core
        FMS["Feed Management"]:::core
        SYS["Sync System"]:::core
        
        FPS["Feed Parser"]:::core
        RSS["RSS Parser"]:::core
        ATM["Atom Parser"]:::core
        
        FPS --> RSS & ATM
    end
    
    subgraph SI["Service Integration"]
        direction TB
        CKI["CloudKit Integration"]:::service
        FBI["Feedbin Integration"]:::service
        NBI["NewsBlur Integration"]:::service
        FDI["Feedly Integration"]:::service
        RAI["Reader API"]:::service
    end
    
    subgraph DL["Data Layer"]
        direction TB
        ADB["Articles Database"]:::data
        SDB["Sync Database"]:::data
        DM["Data Models"]:::data
    end
    
    %% Relationships
    UI --> BL
    BL --> SI
    SI --> DL
    
    %% Click Events
    click AMS "https://github.com/Ranchero-Software/NetNewsWire/blob/main/Account/Sources/Account/AccountManager.swift"
    click APS "https://github.com/Ranchero-Software/NetNewsWire/blob/main/Articles/Sources/Articles/Article.swift"
    click FMS "https://github.com/Ranchero-Software/NetNewsWire/blob/main/Account/Sources/Account/Feed.swift"
    click SYS "https://github.com/Ranchero-Software/NetNewsWire/blob/main/SyncDatabase/Sources/SyncDatabase/SyncDatabase.swift"
    click FPS "https://github.com/Ranchero-Software/NetNewsWire/blob/main/Parser/Sources/Parser/FeedParser/Feeds/FeedParser.swift"
    click RSS "https://github.com/Ranchero-Software/NetNewsWire/blob/main/Parser/Sources/Parser/FeedParser/Feeds/XML/RSSParser.swift"
    click ATM "https://github.com/Ranchero-Software/NetNewsWire/blob/main/Parser/Sources/Parser/FeedParser/Feeds/XML/AtomParser.swift"
    click CKI "https://github.com/Ranchero-Software/NetNewsWire/blob/main/Account/Sources/Account/CloudKit/CloudKitAccountDelegate.swift"
    click FBI "https://github.com/Ranchero-Software/NetNewsWire/blob/main/Account/Sources/Account/Feedbin/FeedbinAccountDelegate.swift"
    click NBI "https://github.com/Ranchero-Software/NetNewsWire/blob/main/Account/Sources/Account/NewsBlur/NewsBlurAccountDelegate.swift"
    click FDI "https://github.com/Ranchero-Software/NetNewsWire/blob/main/Account/Sources/Account/Feedly/FeedlyAccountDelegate.swift"
    click RAI "https://github.com/Ranchero-Software/NetNewsWire/blob/main/Account/Sources/Account/ReaderAPI/ReaderAPIAccountDelegate.swift"
    click ADB "https://github.com/Ranchero-Software/NetNewsWire/blob/main/ArticlesDatabase/Sources/ArticlesDatabase/ArticlesDatabase.swift"
    click SDB "https://github.com/Ranchero-Software/NetNewsWire/blob/main/SyncDatabase/Sources/SyncDatabase/SyncDatabase.swift"
    click DM "https://github.com/Ranchero-Software/NetNewsWire/blob/main/Articles/Sources/Articles/Article.swift"
    click TML "https://github.com/Ranchero-Software/NetNewsWire/blob/main/Mac/MainWindow/Timeline/TimelineViewController.swift"
    click ART "https://github.com/Ranchero-Software/NetNewsWire/blob/main/Mac/MainWindow/Detail/DetailViewController.swift"
    click SBR "https://github.com/Ranchero-Software/NetNewsWire/blob/main/Mac/MainWindow/Sidebar/SidebarViewController.swift"
    click INS "https://github.com/Ranchero-Software/NetNewsWire/blob/main/Mac/Inspector/InspectorWindowController.swift"
    
    %% Styles
    classDef core fill:#2374ab
    classDef data fill:#2a9d8f
    classDef service fill:#e76f51
    classDef ui fill:#8338ec
```
