# chandru89new/rdigest architecture

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

- Interactive diagram: https://gitdiagram.com/chandru89new/rdigest
- Repository: https://github.com/chandru89new/rdigest

## Overview

##### Core Application Components
- Command Line Interface (CLI)
- Feed Manager
- Database Handler
- HTML Generator
- Content Fetcher

##### External Dependencies
- SQLite Database
- RSS Feeds (External)
- File System (for digest storage)

##### Component Relationships

- [CLI Commands] → [Command Handler]
- ↓
- [Feed Manager] ←→ [Content Fetcher]
- ↓
- [Database Handler] → [HTML Generator]
- ↓
- [Storage Systems]

##### Specific Elements

a. Command Flow:
- How each CLI command (`add`, `remove`, `refresh`, `digest`, etc.) flows through the system
- Command validation and routing

b. Data Flow:
- RSS Feed fetching process
- Content storage in SQLite
- Digest generation and storage as HTML

c. Storage Interactions:
- SQLite database operations
- HTML digest file creation
- Environment variable configuration

##### Important Notes
- `RDIGEST_FOLDER` environment variable configuration
- Template system (index-template.html)
- Migration system (migrations/1.sql)

- Web Server Interface
- UI Components
- API Layer

##### Version/date information

Key Interactions to Highlight:

##### Feed Management
- [CLI] → [Feed Manager] → [Database]

##### Content Refresh
- [Feed Manager] → [Content Fetcher] → [RSS Feeds]
- → [Database]

##### Digest Generation
- [CLI] → [Database Handler] → [HTML Generator]
- → [File System]

Level of Detail:
- Keep main components visible at a glance
- Database schema in a separate view
- File system structure in a separate view

Remember to:
- Clear labels for all components
- Error handling flows
- Data transformation points
- Asynchronous operations
- Security boundaries
- Configuration points

## Diagram (Mermaid)

```mermaid
%%{init: {'theme': 'base', 'themeVariables': { 'primaryColor': '#597E8D', 'primaryTextColor': '#fff', 'primaryBorderColor': '#597E8D', 'lineColor': '#597E8D', 'secondaryColor': '#937DAD', 'tertiaryColor': '#F9B697' }}}%%

flowchart TB
    classDef cli fill:#2E86C1,stroke:#1A5276,color:white
    classDef core fill:#27AE60,stroke:#196F3D,color:white
    classDef storage fill:#E67E22,stroke:#A04000,color:white
    classDef external fill:#F1C40F,stroke:#B7950B,color:white
    classDef future fill:#95A5A6,stroke:#616A6B,color:white,stroke-dasharray: 5 5
    
    subgraph Interface
        CLI["Command Line Interface"]:::cli
        click CLI "https://github.com/chandru89new/rdigest/blob/main/app/Main.hs"
    end

    subgraph Core["Application Layer"]
        CmdHandler["Command Handler"]:::core
        FeedMgr["Feed Manager"]:::core
        ContentFetch["Content Fetcher"]:::core
        DBHandler["Database Handler"]:::core
        click DBHandler "https://github.com/chandru89new/rdigest/blob/main/migrations/1.sql"
        HTMLGen["HTML Generator"]:::core
        click HTMLGen "https://github.com/chandru89new/rdigest/blob/main/index-template.html"
        click HTMLGen "https://github.com/chandru89new/rdigest/blob/main/template.html"
    end

    subgraph Storage["Storage Layer"]
        DB[(SQLite Database)]:::storage
        FileSystem[("File System\n(RDIGEST_FOLDER)")]:::storage
    end

    subgraph External["External Systems"]
        RSSFeeds[("RSS Feeds")]:::external
    end

    subgraph Future["Future Components"]
        WebServer["Web Server"]:::future
        UIComp["UI Components"]:::future
        APILayer["API Layer"]:::future
    end

    %% Connections
    CLI --> CmdHandler
    CmdHandler --> FeedMgr
    FeedMgr <--> ContentFetch
    ContentFetch <--> RSSFeeds
    FeedMgr --> DBHandler
    DBHandler --> DB
    DBHandler --> HTMLGen
    HTMLGen --> FileSystem

    %% Future Connections
    WebServer -.-> APILayer
    APILayer -.-> DBHandler
    WebServer -.-> UIComp

    %% Build System
    BuildConfig["Build Configuration"]:::core
    click BuildConfig "https://github.com/chandru89new/rdigest/blob/main/rdigest.cabal"
    
    %% CI/CD
    CICD["CI/CD Pipeline"]:::core
    click CICD "https://github.com/chandru89new/rdigest/blob/main/.github/workflows/haskell.yml"

    %% Legend
    subgraph Legend
        CLI_L["Interface Components"]:::cli
        CORE_L["Core Components"]:::core
        STORAGE_L["Storage Components"]:::storage
        EXTERNAL_L["External Systems"]:::external
        FUTURE_L["Future Components"]:::future
    end
```
