# tsjdev-apps/podcastr-console architecture

> Architecture diagram of the GitHub repository tsjdev-apps/podcastr-console, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-07-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/tsjdev-apps/podcastr-console
- Repository: https://github.com/tsjdev-apps/podcastr-console

## Overview

##### Project Type and Purpose
- This is a .NET 9 console application (“Podcastr”) whose purpose is to automate end-to-end podcast creation using Azure OpenAI services.
- The user interacts via CLI; under the hood it fetches content, invokes AI models (chat, TTS, image), and packages outputs into a ZIP.

##### File Structure Analysis
- Top level: Podcastr.sln, README, docs (assets), slides.
- src/Podcastr:
- Program.cs – CLI entry point
- Utils – Secrets.cs, Statics.cs (configuration, credentials)
- Helpers – interaction layers (AzureOpenAIHelper, ConsoleHelper, FileHelper, TableHelper, TokenUsageHelper, WebsiteHelper, ZipArchiveHelper)
- Models – domain DTOs (PodcastContent, Row, SocialMediaPosts, ZipElement)
- Exceptions – AzureOpenAIException for error handling

##### Key Architectural Patterns
- Layered/Clean-architecture style separation:
- Presentation (CLI)
- Application services (Helpers)
- Domain models
- Infrastructure (external service calls, file I/O)
- Single-process, synchronous flow with modular helpers.
- External dependencies: Azure OpenAI (chat + image), Azure TTS, HTTP (website scraping), local file system.

##### Main Components
a. Presentation Layer
- **Console UI** (Program.cs + ConsoleHelper)
b. Application Layer
- **Core Orchestrator** (Podcastr logic invoking helpers based on user choices)
- WebsiteHelper (fetches content URL)
- AzureOpenAIHelper (chat + structured outputs)
- ZipArchiveHelper (packages assets)
- FileHelper (read/write)
- TableHelper & TokenUsageHelper (reporting)
- SecretProvider (Utils.Statics, Secrets)
c. Domain Model
- PodcastContent, SocialMediaPosts, ZipElement, Row
d. Infrastructure / External Services
- Azure OpenAI Chat Model
- Azure OpenAI TTS Model
- Azure OpenAI Image Model
- HTTP Endpoint (content URL)
- Local File System / ZIP Archive

##### Relationships and Data Flow
1. User → Console UI: enters Content URL, Name, Language, Voice
2. Console UI → WebsiteHelper: HTTP GET to Content URL → returns raw text
3. Orchestrator → AzureOpenAIHelper
- Chat API call to generate script, description, social posts (JSON structured)
- Image API call to generate cover
- TTS API call to generate audio
4. Orchestrator → FileHelper: write each artifact to disk
5. Orchestrator → ZipArchiveHelper: collect artifacts → produce final ZIP
6. TokenUsageHelper & TableHelper → report cost/usage back to Console UI

##### Technologies and Frameworks
- .NET 9 console application
- Spectre.Console (for rich CLI UX)
- Azure.AI.OpenAI SDK
- System.IO.Compression (for ZIP)
- HTTPClient (inside WebsiteHelper)

##### Essential Elements to Capture
- Clear component boundaries (UI vs. Helpers vs. Models vs. External)
- External AI services distinctly shown
- Storage components for intermediate and final artifacts
- Utility modules (Secrets, Statics) feeding configuration into the pipeline

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Presentation Layer
    subgraph "Presentation Layer"
        Program["Program.cs (Orchestrator)"]:::presentation
        ConsoleHelper["ConsoleHelper"]:::presentation
    end

    %% Application Layer
    subgraph "Application Layer"
        WebsiteHelper["WebsiteHelper"]:::app
        AzureOpenAIHelper["AzureOpenAIHelper"]:::app
        FileHelper["FileHelper"]:::app
        ZipArchiveHelper["ZipArchiveHelper"]:::app
        TableHelper["TableHelper"]:::app
        TokenUsageHelper["TokenUsageHelper"]:::app
        AzureOpenAIException["AzureOpenAIException"]:::app
    end

    %% Configuration Layer
    subgraph "Configuration"
        Secrets["Secrets"]:::app
        Statics["Statics"]:::app
    end

    %% Domain Models
    subgraph "Domain Models"
        PodcastContent["PodcastContent"]:::domain
        Row["Row"]:::domain
        SocialMediaPosts["SocialMediaPosts"]:::domain
        ZipElement["ZipElement"]:::domain
    end

    %% External Services
    subgraph "Infrastructure / External Services"
        HTTPContent["HTTP Endpoint"]:::external
        AzureChat["Azure OpenAI Chat"]:::external
        AzureImage["Azure OpenAI Image"]:::external
        AzureTTS["Azure OpenAI TTS"]:::external
    end

    %% Storage
    FileSystem["File System / ZIP Storage"]:::storage

    %% Users
    User((User)):::external

    %% Data Flow
    User -->|"start CLI"| Program
    Program -->|"prompt"| ConsoleHelper
    ConsoleHelper -->|"user input"| Program
    Program -->|"fetch content"| WebsiteHelper
    WebsiteHelper -->|"HTTP GET"| HTTPContent
    HTTPContent -->|"raw text"| WebsiteHelper
    WebsiteHelper -->|"raw text"| Program

    Program -->|"generate content"| AzureOpenAIHelper
    AzureOpenAIHelper -->|"chat prompt\n& JSON schema"| AzureChat
    AzureChat -->|"script JSON"| AzureOpenAIHelper
    AzureOpenAIHelper -->|"image prompt"| AzureImage
    AzureImage -->|"image binary"| AzureOpenAIHelper
    AzureOpenAIHelper -->|"TTS request"| AzureTTS
    AzureTTS -->|"audio bytes"| AzureOpenAIHelper
    AzureOpenAIHelper -->|"structured DTOs"| Program
    AzureOpenAIHelper -->|"on error"| AzureOpenAIException

    Program -->|"write artifacts"| FileHelper
    FileHelper -->|"files"| FileSystem

    Program -->|"collect artifacts"| ZipArchiveHelper
    ZipArchiveHelper -->|"zip file"| FileSystem

    Program -->|"track tokens"| TokenUsageHelper
    TokenUsageHelper -->|"usage data"| TableHelper
    TableHelper -->|"report"| ConsoleHelper

    Secrets --> AzureOpenAIHelper
    Statics --> AzureOpenAIHelper
    Secrets --> WebsiteHelper
    Statics --> WebsiteHelper

    %% Click Events
    click Program "https://github.com/tsjdev-apps/podcastr-console/blob/main/src/Podcastr/Program.cs"
    click ConsoleHelper "https://github.com/tsjdev-apps/podcastr-console/blob/main/src/Podcastr/Helpers/ConsoleHelper.cs"
    click WebsiteHelper "https://github.com/tsjdev-apps/podcastr-console/blob/main/src/Podcastr/Helpers/WebsiteHelper.cs"
    click AzureOpenAIHelper "https://github.com/tsjdev-apps/podcastr-console/blob/main/src/Podcastr/Helpers/AzureOpenAIHelper.cs"
    click ZipArchiveHelper "https://github.com/tsjdev-apps/podcastr-console/blob/main/src/Podcastr/Helpers/ZipArchiveHelper.cs"
    click FileHelper "https://github.com/tsjdev-apps/podcastr-console/blob/main/src/Podcastr/Helpers/FileHelper.cs"
    click TableHelper "https://github.com/tsjdev-apps/podcastr-console/blob/main/src/Podcastr/Helpers/TableHelper.cs"
    click TokenUsageHelper "https://github.com/tsjdev-apps/podcastr-console/blob/main/src/Podcastr/Helpers/TokenUsageHelper.cs"
    click AzureOpenAIException "https://github.com/tsjdev-apps/podcastr-console/blob/main/src/Podcastr/Exceptions/AzureOpenAIException.cs"
    click Secrets "https://github.com/tsjdev-apps/podcastr-console/blob/main/src/Podcastr/Utils/Secrets.cs"
    click Statics "https://github.com/tsjdev-apps/podcastr-console/blob/main/src/Podcastr/Utils/Statics.cs"
    click PodcastContent "https://github.com/tsjdev-apps/podcastr-console/blob/main/src/Podcastr/Models/PodcastContent.cs"
    click Row "https://github.com/tsjdev-apps/podcastr-console/blob/main/src/Podcastr/Models/Row.cs"
    click SocialMediaPosts "https://github.com/tsjdev-apps/podcastr-console/blob/main/src/Podcastr/Models/SocialMediaPosts.cs"
    click ZipElement "https://github.com/tsjdev-apps/podcastr-console/blob/main/src/Podcastr/Models/ZipElement.cs"

    %% Styles
    classDef presentation fill:#AED6F1,stroke:#21618C,color:#1B2631;
    classDef app fill:#A9DFBF,stroke:#1D8348,color:#145A32;
    classDef domain fill:#F9E79F,stroke:#B7950B,color:#7D6608;
    classDef external fill:#D7BDE2,stroke:#7D3C98,color:#4A235A;
    classDef storage fill:#F5B7B1,stroke:#943126,color:#641E16
```
