# mhitza/subscriptions-digest architecture

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

## Overview

##### Main Components

a. External Services Layer:
- GitHub Actions (Scheduler/Trigger)
- Email Service Providers (SES, Gmail, Mandrill, etc.)
- GitHub API (for tracking last run)
- RSS Feed Sources
- Gist (for configuration storage)

b. Application Core:
- Configuration Manager
- Feed Processor
- Digest Generator
- Email Formatter
- Mailer Service

##### Component Relationships

- Configuration flow from Gist to the application
- Feed processing pipeline
- Demonstrate email generation and delivery flow

##### Specific Implementation Details

- Blue rectangles for external services
- Green rectangles for core application components
- Yellow diamonds for decision points
- Red rectangles for critical configuration elements

##### Data Flow Representation

- Configuration loading (Gist → Application)
- Feed fetching (RSS Sources → Feed Processor)
- Email generation (Digest Generator → Email Service)
- State management (GitHub API interactions)

##### Key Technical Elements

Specific components:
- Symfony Mailer integration
- Twig templating system (template.html.twig)
- YAML configuration handling
- Command line interface (RunCommand.php)

**[Triggers Layer]**
- GitHub Actions (Scheduled Tasks)
- ↓
**[Configuration Layer]**
- Gist Config → YAML Parser
- ↓
**[Processing Layer]**
- Feed Fetcher → Content Processor → Digest Generator
- ↓
**[Template Layer]**
- Twig Template Engine
- ↓
**[Delivery Layer]**
- Symfony Mailer → Email Service Provider

##### Automation aspect by clearly showing the GitHub Actions workflows
- scheduled-digest.yml (daily runs)
- scheduled-sync.yml (weekly updates)

2. A state management section showing how the system tracks the last run using GitHub API

## Diagram (Mermaid)

```mermaid
graph TB
    %% Define styles
    classDef external fill:#ADD8E6,stroke:#333
    classDef core fill:#90EE90,stroke:#333
    classDef config fill:#FFD700,stroke:#333
    classDef critical fill:#FF6B6B,stroke:#333
    classDef template fill:#DDA0DD,stroke:#333

    %% Triggers Layer
    subgraph Triggers
        GHA["GitHub Actions Scheduler"]:::external
        GHAS["GitHub Actions Sync"]:::external
    end

    %% External Services Layer
    subgraph ExternalServices
        GHAPI["GitHub API"]:::external
        RSS["RSS Feed Sources"]:::external
        GIST["Gist Storage"]:::external
        ESP["Email Service Providers"]:::external
    end

    %% Configuration Layer
    subgraph ConfigLayer
        CM["Configuration Manager"]:::config
        YAML["YAML Parser"]:::config
    end

    %% Processing Layer
    subgraph ProcessingLayer
        CLI["Command Line Interface"]:::core
        FP["Feed Processor"]:::core
        DG["Digest Generator"]:::core
    end

    %% Template Layer
    subgraph TemplateLayer
        TE["Twig Template Engine"]:::template
        TWIG["Template Extensions"]:::template
        ET["Email Template"]:::template
    end

    %% Delivery Layer
    subgraph DeliveryLayer
        SM["Symfony Mailer"]:::core
    end

    %% Relationships
    GHA --> CLI
    GHAS --> GHAPI
    GIST --> CM
    CM --> YAML
    YAML --> CLI
    CLI --> FP
    RSS --> FP
    FP --> DG
    DG --> TE
    TE --> ET
    TWIG --> TE
    ET --> SM
    SM --> ESP
    GHAPI --> CLI

    %% Click events
    click GHA "https://github.com/mhitza/subscriptions-digest/blob/master/.github/workflows/scheduled-digest.yml"
    click GHAS "https://github.com/mhitza/subscriptions-digest/blob/master/.github/workflows/scheduled-sync.yml"
    click CLI "https://github.com/mhitza/subscriptions-digest/blob/master/src/Command/RunCommand.php"
    click ET "https://github.com/mhitza/subscriptions-digest/blob/master/template.html.twig"
    click YAML "https://github.com/mhitza/subscriptions-digest/blob/master/config.example.yml"
    click TWIG "https://github.com/mhitza/subscriptions-digest/blob/master/src/Twig/TwigExtension.php"

    %% Legend
    subgraph Legend
        E1["External Services"]:::external
        C1["Core Components"]:::core
        CF1["Configuration"]:::config
        CR1["Critical Elements"]:::critical
        T1["Template Components"]:::template
    end
```
