# adrienpoly/rubyvideo architecture

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

- Interactive diagram: https://gitdiagram.com/adrienpoly/rubyvideo
- Repository: https://github.com/adrienpoly/rubyvideo

## Overview

##### Main Components

a. Frontend Layer:
- Hotwire (Turbo + Stimulus)
- Vite for asset bundling
- Tailwind CSS with daisyUI
- View Transitions API integration

b. Application Layer:
- Ruby on Rails application server
- Controllers structure (standard + API endpoints)
- Avo admin panel
- Authentication system
- Background job processing (Solid Queue)

c. Data Layer:
- SQLite database
- Solid Cache for caching
- Meilisearch for search functionality
- File storage for assets

d. External Services:
- YouTube API integration
- GitHub integration
- AppSignal for monitoring
- Kamal for deployment

**┌─────────────────────────────────────────────────────────────┐**
- Client Layer                           │
- ┌─────────────┐  ┌─────────────┐  ┌─────────────┐        │
- Browser   │  │   Hotwire   │  │    Vite     │        │
- ┘  └─────────────┘  └─────────────┘        │
- ┬─────────────────────────────────┘

**┌───────────────────────────┼─────────────────────────────────┐**
- ▼                                  │
- Application Layer                         │
- ┌─────────────┐  ┌─────────────┐  ┌─────────────┐        │
- Rails App  │  │  Avo Admin  │  │   Solid     │        │
- ◄─►│   Panel    │◄─►│   Queue     │        │
- ┘  └─────────────┘  └─────────────┘        │
- ▲                ▲                ▲                 │
- ┼────────────────┼────────────────┼─────────────────┘

**┌─────────┼────────────────┼────────────────┼─────────────────┐**
- ▼                ▼                ▼                  │
- Data Layer                              │
- ┌─────────────┐  ┌─────────────┐  ┌─────────────┐        │
- SQLite    │  │ Meilisearch │  │    Solid    │        │
- Database   │  │             │  │    Cache     │        │
- ┘  └─────────────┘  └─────────────┘        │
- ┬─────────────────────────────────┘

**┌───────────────────────────┼─────────────────────────────────┐**
- ▼                                  │
- External Services                          │
- ┌─────────────┐  ┌─────────────┐  ┌─────────────┐        │
- YouTube    │  │   GitHub    │  │  AppSignal  │        │
- API      │  │     API     │  │             │        │
- ┘  └─────────────┘  └─────────────┘        │
- ┘

##### Key Relationships to Highlight
- Hotwire's real-time updates flow
- Background job processing path
- Search functionality flow
- Authentication flow
- Video processing pipeline

##### Important Implementation Details
- MVC pattern within Rails
- Event-driven architecture for real-time features
- Caching points
- Security boundaries

##### Deployment Flow
- Kamal deployment pipeline
- Docker container organization
- Monitoring points

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles and classes
    classDef frontend fill:#3498db,stroke:#2980b9,color:white
    classDef application fill:#2ecc71,stroke:#27ae60,color:white
    classDef data fill:#f1c40f,stroke:#f39c12,color:black
    classDef external fill:#95a5a6,stroke:#7f8c8d,color:white

    %% Client Layer
    subgraph ClientLayer["Client Layer"]
        Browser["Browser"]
        Hotwire["Hotwire (Turbo + Stimulus)"]
        Vite["Vite Assets"]
        TailwindCSS["Tailwind + daisyUI"]
    end

    %% Application Layer
    subgraph AppLayer["Application Layer"]
        RailsApp["Rails Application"]
        AvoAdmin["Avo Admin Panel"]
        Controllers["Controllers"]
        Auth["Authentication"]
        Jobs["Background Jobs"]
        ViewComponents["View Components"]
    end

    %% Data Layer
    subgraph DataLayer["Data Layer"]
        DB[(SQLite Database)]
        Search[(Meilisearch)]
        Cache[(Solid Cache)]
        Models["Core Models"]
    end

    %% External Services Layer
    subgraph ExternalLayer["External Services"]
        YouTube["YouTube API"]
        GitHub["GitHub API"]
        AppSignal["AppSignal"]
        Kamal["Kamal Deploy"]
    end

    %% Relationships
    Browser --> Hotwire
    Hotwire --> RailsApp
    Vite --> RailsApp
    TailwindCSS --> RailsApp

    RailsApp --> Controllers
    RailsApp --> AvoAdmin
    RailsApp --> Auth
    RailsApp --> Jobs
    RailsApp --> ViewComponents

    Controllers --> Models
    Models --> DB
    Models --> Search
    Models --> Cache

    RailsApp --> YouTube
    RailsApp --> GitHub
    RailsApp --> AppSignal
    Kamal --> RailsApp

    %% Styling
    class Browser,Hotwire,Vite,TailwindCSS frontend
    class RailsApp,AvoAdmin,Controllers,Auth,Jobs,ViewComponents application
    class DB,Search,Cache,Models data
    class YouTube,GitHub,AppSignal,Kamal external

    %% Click events
    click Hotwire "https://github.com/adrienpoly/rubyvideo/tree/main/app/javascript/controllers/"
    click Vite "https://github.com/adrienpoly/rubyvideo/blob/main/vite.config.mjs"
    click TailwindCSS "https://github.com/adrienpoly/rubyvideo/tree/main/app/assets/stylesheets/"
    click ViewComponents "https://github.com/adrienpoly/rubyvideo/tree/main/app/components/"
    click Controllers "https://github.com/adrienpoly/rubyvideo/tree/main/app/controllers/"
    click AvoAdmin "https://github.com/adrienpoly/rubyvideo/tree/main/app/avo/"
    click Auth "https://github.com/adrienpoly/rubyvideo/tree/main/app/controllers/identity/"
    click Jobs "https://github.com/adrienpoly/rubyvideo/tree/main/app/jobs/"
    click DB "https://github.com/adrienpoly/rubyvideo/blob/main/config/database.yml"
    click Search "https://github.com/adrienpoly/rubyvideo/blob/main/config/initializers/meilisearch.rb"
    click Cache "https://github.com/adrienpoly/rubyvideo/blob/main/config/cache.yml"
    click YouTube "https://github.com/adrienpoly/rubyvideo/tree/main/app/clients/youtube/"
    click GitHub "https://github.com/adrienpoly/rubyvideo/tree/main/app/clients/github/"
    click AppSignal "https://github.com/adrienpoly/rubyvideo/blob/main/config/appsignal.yml"
    click Kamal "https://github.com/adrienpoly/rubyvideo/tree/main//.kamal/"
    click Models "https://github.com/adrienpoly/rubyvideo/tree/main/app/models/"
```
