# nfqakademija/podcast architecture

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

- Interactive diagram: https://gitdiagram.com/nfqakademija/podcast
- Repository: https://github.com/nfqakademija/podcast

## Overview

##### Project type and purpose
- This is a full-stack web application built with Symfony (PHP) that aggregates Lithuanian basketball podcasts from multiple sources, enriches them using the YouTube API and a custom crawler, stores everything in MySQL, sends various newsletters, and exposes both a public-facing site (Twig + CSS/JS assets) and CLI commands for data collection.

##### File structure
- Top-level “src/” holds the Symfony application:
- Controllers (web endpoints)
- Services (CrawlerService, YoutubeService, MailService, etc.)
- Entities + Repositories (Podcast, Source, Subscriber, User, Comment, Tag)
- Commands (NewsletterSendingCommand, PodcastsCollectingCommand)
- EventListener (SendConfirmationEmailListener)
- “templates/” houses Twig templates for UI and emails
- “assets/” + webpack.config.js for frontend CSS/JS, built via Webpack Encore
- “public/” is the document root (index.php, static assets)
- “config/” holds all Symfony and environment configuration
- “scripts/” and “.deploy/” scripts for Docker orchestration, building, deployment
- Docker-related files (Docker Compose YMLs, .env, .env.test) indicate a containerized setup

##### README for additional insights
- Uses PHP 7.3, MySQL, Nginx, Docker
- Core features: filters, search, RSS, likes/dislikes, listen later, comments, multiple newsletter flows
- Integrations: Symfony DomCrawler for scraping, YouTube Data API v3, Mailer URL (SMTP or API)
- CLI commands for initial data collection and recurring podcast collection

##### Elements
- Browser ↔ Nginx → Symfony HTTP
- Symfony HTTP → Doctrine → MySQL
- Cron/CLI → Symfony Console → Services → MySQL
- Symfony Services → External APIs (YouTube, Mailer)
- Green for external services
- Blue for containers/services you manage
- Orange for data stores
- Protocols where relevant (HTTP, TCP/MySQL, SMTP/Web API)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Presentation Layer
    Browser["Browser"]:::blue

    %% Edge Router / Web Server
    subgraph "Edge Layer"
        Nginx["Nginx (HTTP)"]:::blue
        Public["public/ (Static Assets)"]:::blue
    end

    Browser -->|HTTP| Nginx
    Nginx -->|serves| Public
    Public -->|serves CSS/JS| Browser

    %% Application Layer
    subgraph "Application Layer (PHP-FPM Container)"
        PHPFPM["PHP-FPM\nSymfony HTTP & Console"]:::blue

        subgraph "HTTP Layer"
            Controllers["Controllers\n(src/Controller/)"]:::blue
        end

        subgraph "Service Layer"
            Services["Services\n(src/Service/)"]:::blue
        end

        subgraph "Data Access Layer"
            Repositories["Repositories\n(src/Repository/)"]:::blue
            Entities["Entities\n(src/Entity/)"]:::orange
        end

        subgraph "CLI Layer"
            Commands["Console Commands\n(src/Command/)"]:::blue
        end

        subgraph "Event-Driven Emailing"
            Listener["SendConfirmationEmailListener\n(src/EventListener/)"]:::blue
        end
    end

    Nginx -->|fastCGI| PHPFPM
    PHPFPM --> Controllers
    Controllers -->|calls| Services
    Services -->|uses| Repositories
    Repositories -->|manages| Entities
    Entities -->|persist| MySQLdb

    %% CLI and Event flows
    Commands -->|invokes| Services
    Listener -->|triggers| Services

    %% Persistence Layer
    MySQLdb[(MySQL Database)]:::orange
    Entities --- MySQLdb

    %% External Integrations
    Services -->|REST API| YouTubeAPI["YouTube Data API"]:::green
    Services -->|SMTP/Web API| Mailer["Mailer (SMTP/API)"]:::green

    %% Asset Build
    Assets["Webpack Encore\nassets/css/, assets/js/\nwebpack.config.js"]:::blue
    Assets -->|build| Public

    %% Click Events
    click Controllers "https://github.com/nfqakademija/podcast/tree/master/src/Controller/"
    click Services "https://github.com/nfqakademija/podcast/tree/master/src/Service/"
    click Repositories "https://github.com/nfqakademija/podcast/tree/master/src/Repository/"
    click Entities "https://github.com/nfqakademija/podcast/tree/master/src/Entity/"
    click Commands "https://github.com/nfqakademija/podcast/tree/master/src/Command/"
    click Listener "https://github.com/nfqakademija/podcast/blob/master/src/EventListener/SendConfirmationEmailListener.php"
    click Public "https://github.com/nfqakademija/podcast/tree/master/public/"
    click Assets "https://github.com/nfqakademija/podcast/blob/master/webpack.config.js"

    %% Styles
    classDef blue fill:#D6E4FF,stroke:#0B5394,stroke-width:1px;
    classDef orange fill:#FFE7BA,stroke:#B35F00,stroke-width:1px;
    classDef green fill:#D4F8E8,stroke:#0C7A55,stroke-width:1px;
```
