# eduardosasso/bullish architecture

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

- Interactive diagram: https://gitdiagram.com/eduardosasso/bullish
- Repository: https://github.com/eduardosasso/bullish

## Overview

##### Main Components
- Core Application (bullish.rb): This is the entry point that orchestrates the execution of the newsletter generation process.
- Editions Module (editions folder): Contains different newsletter “editions” (morning, afternoon, free, widgets) that determine how content is laid out.
- Service Modules (services folder): A series of Ruby service classes that fetch, process, and transform various types of data (e.g., crypto data, stock futures, indexes, news feeds, and email generation). Notice there’s also a dedicated subfolder for news, implying a specialized process.
- Web Assets and Presentation (site folder): Hosts static site files, CSS, JavaScript, blog posts, and landing page content. This layer is used to display information about Bullish▲ online and support subscription, error pages, and legal pages.
- CI/CD & Deployment Components: With a .github/workflows folder (using GitHub Actions) and netlify.toml, the project integrates continuous integration and deployment, using Netlify to serve the site.
- Testing Infrastructure (test folder): Encompasses unit tests for editions, services, and templates ensuring the various components work as expected.

##### Detail the Relationships and Data Flow
- The Core Application (bullish.rb) acts as the central controller that:
- Invokes the specific edition (e.g., morning or afternoon) from the Editions module.
- For each edition, leverages various service modules that fetch data (e.g., crypto, futures, sector, trending, etc.).
- Uses the Templating components to integrate the data into HTML email formats.
- Possibly triggers the email service (email.rb) in the services folder to distribute the newsletter.
- The Site folder is responsible for static content that supports the overall brand (including blog posts and landing pages), which may be automatically deployed via Netlify.
- The CI/CD workflow utilizes GitHub Actions to run tests (from the test folder) and build the app, while deployment is managed by Netlify.

- Surround it with interconnected modules:
- To its left: Editions and Services (as sources of data and processing).
- To its right: Templates, which lead into two outputs: the Email Newsletter (via email service) and the Static Web Site.
- At the top/bottom: CI/CD constructs (GitHub Actions, Testing) and Deployment (Netlify) that influence the entire system.

## Diagram (Mermaid)

```mermaid
flowchart TD
    CI_CD["CI/CD & Deployment\n(.github/workflows, netlify.toml)"]:::deployment
    Testing["Testing Infrastructure\n(test/)"]:::testing
    Bullish["Bullish Application (bullish.rb)"]:::core

    subgraph "Editions Module"
        Editions["Editions Module"]:::editions
        Morning["Morning Edition"]:::editions
        Afternoon["Afternoon Edition"]:::editions
        Free["Free Edition"]:::editions
        Widgets["Widgets Edition"]:::editions
        Editions -->|"contains"| Morning
        Editions -->|"contains"| Afternoon
        Editions -->|"contains"| Free
        Editions -->|"contains"| Widgets
    end

    subgraph "Services Module"
        Services["Services Module"]:::services
        Crypto["Crypto Service"]:::services
        Futures["Futures Service"]:::services
        EmailS["Email Service"]:::services
        News["News Service"]:::services
        Services -->|"contains"| Crypto
        Services -->|"contains"| Futures
        Services -->|"contains"| EmailS
        Services -->|"contains"| News
    end

    Templates["Templates"]:::templates
    EmailOutput["Email Newsletter"]:::templates
    SiteOutput["Static Web Site"]:::site

    CI_CD ---|"builds"| Bullish
    Testing ---|"validates"| Bullish

    Bullish -->|"selects"| Editions
    Bullish -->|"fetches_data"| Services

    Editions -->|"formats"| Templates
    Services -->|"supplies_data"| Templates

    Templates -->|"renders_email"| EmailOutput
    Templates -->|"renders_site"| SiteOutput

    click Bullish "https://github.com/eduardosasso/bullish/blob/master/bullish.rb"
    click Editions "https://github.com/eduardosasso/bullish/tree/master/editions/"
    click Morning "https://github.com/eduardosasso/bullish/blob/master/editions/morning.rb"
    click Afternoon "https://github.com/eduardosasso/bullish/blob/master/editions/afternoon.rb"
    click Free "https://github.com/eduardosasso/bullish/blob/master/editions/free.rb"
    click Widgets "https://github.com/eduardosasso/bullish/blob/master/editions/widgets.rb"
    click Services "https://github.com/eduardosasso/bullish/tree/master/services/"
    click Crypto "https://github.com/eduardosasso/bullish/blob/master/services/crypto.rb"
    click Futures "https://github.com/eduardosasso/bullish/blob/master/services/futures.rb"
    click EmailS "https://github.com/eduardosasso/bullish/blob/master/services/email.rb"
    click News "https://github.com/eduardosasso/bullish/tree/master/services/news/"
    click Templates "https://github.com/eduardosasso/bullish/tree/master/templates/"
    click SiteOutput "https://github.com/eduardosasso/bullish/tree/master/site/"
    click CI_CD "https://github.com/eduardosasso/bullish/blob/master/.github/workflows/build.yml"
    click Testing "https://github.com/eduardosasso/bullish/tree/master/test/"

    classDef core fill:#FFD700,stroke:#333,stroke-width:2px;
    classDef editions fill:#AFEEEE,stroke:#333,stroke-width:2px;
    classDef services fill:#ADD8E6,stroke:#333,stroke-width:2px;
    classDef templates fill:#98FB98,stroke:#333,stroke-width:2px;
    classDef deployment fill:#FFB6C1,stroke:#333,stroke-width:2px;
    classDef testing fill:#DDA0DD,stroke:#333,stroke-width:2px;
    classDef site fill:#F0E68C,stroke:#333,stroke-width:2px;
```
