# eduardostuart/paperboy architecture

> Architecture diagram of the GitHub repository eduardostuart/paperboy, 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/eduardostuart/paperboy
- Repository: https://github.com/eduardostuart/paperboy

## Overview

##### Main Components

a) Core Components:
- CLI Interface Layer
- RSS Processing Engine
- Email Delivery System
- Configuration Management
- Subscription Management

b) External Dependencies:
- SMTP Server
- RSS Feed Sources
- Template Engine (Handlebars)

**Top Layer: User Interface**

**Middle Layer: Core Services**

**Bottom Layer: External Services**

##### Component Relationships

- User input → CLI Interface
- CLI Interface → RSS Processor
- RSS Processor → Subscription Manager
- RSS Processor → Email System
- Email System → SMTP Server
- Template Engine → Email System

##### Specific Implementation Details

a) paperboy-cli crate:
- CLI Module (cli.rs)
- Delivery Module (deliver.rs)

b) paperboy crate:
- Mailer Module (mailer.rs)
- RSS Module (rss.rs)
- Subscriptions Module (subscriptions.rs)
- Error Handling (error.rs)

##### Key Flows to Highlight

a) Primary Flow:
##### Email is delivered via SMTP

b) Configuration Flow:
- Environment variables → Configuration
- Templates → Email Generation
- Subscription list → RSS Processor

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph User
        UI[User Input]
    end

    subgraph "CLI Layer"
        CLI["CLI Interface"]:::core
        click CLI "https://github.com/eduardostuart/paperboy/blob/main/crates/paperboy-cli/src/cli.rs"
        MAIN["CLI Entry Point"]:::core
        click MAIN "https://github.com/eduardostuart/paperboy/blob/main/crates/paperboy-cli/src/main.rs"
        DEL["Delivery System"]:::core
        click DEL "https://github.com/eduardostuart/paperboy/blob/main/crates/paperboy-cli/src/deliver.rs"
    end

    subgraph "Core Library"
        LIB["Library Entry Point"]:::core
        click LIB "https://github.com/eduardostuart/paperboy/blob/main/crates/paperboy/src/lib.rs"
        RSS["RSS Processing Engine"]:::core
        click RSS "https://github.com/eduardostuart/paperboy/blob/main/crates/paperboy/src/rss.rs"
        SUB["Subscription Manager"]:::core
        click SUB "https://github.com/eduardostuart/paperboy/blob/main/crates/paperboy/src/subscriptions.rs"
        MAIL["Email System"]:::core
        click MAIL "https://github.com/eduardostuart/paperboy/blob/main/crates/paperboy/src/mailer.rs"
        ERR["Error Handler"]:::core
        click ERR "https://github.com/eduardostuart/paperboy/blob/main/crates/paperboy/src/error.rs"
    end

    subgraph "Template System"
        TEMP["Template Engine"]:::template
        DAILY["Daily Email Template"]:::template
        click DAILY "https://github.com/eduardostuart/paperboy/blob/main/emails/daily_email.hbs"
        DAILY_TEXT["Daily Text Template"]:::template
        click DAILY_TEXT "https://github.com/eduardostuart/paperboy/blob/main/emails/daily_email_text.hbs"
    end

    subgraph "External Services"
        SMTP[("SMTP Server")]:::external
        RSS_FEEDS[("RSS Feed Sources")]:::external
    end

    subgraph "Configuration"
        ENV["Environment Variables"]:::config
    end

    %% Relationships
    UI --> CLI
    CLI --> MAIN
    MAIN --> DEL
    DEL --> LIB
    LIB --> RSS
    LIB --> MAIL
    LIB --> SUB
    RSS --> RSS_FEEDS
    RSS --> SUB
    MAIL --> SMTP
    TEMP --> MAIL
    DAILY --> TEMP
    DAILY_TEXT --> TEMP
    ENV -.-> LIB
    ERR -.-> LIB

    %% Styles
    classDef core fill:#2374ab
    classDef external fill:#7dba84
    classDef template fill:#f68b22
    classDef config fill:#949494

    %% Legend
    subgraph Legend
        L1["Core Components"]:::core
        L2[("External Services")]:::external
        L3["Templates"]:::template
        L4["Configuration"]:::config
    end
```
