# nezort11/video-translate-bot architecture

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

- Interactive diagram: https://gitdiagram.com/nezort11/video-translate-bot
- Repository: https://github.com/nezort11/video-translate-bot

## Overview

Key Components to Include:

##### Core Components
- Telegram Bot Service (Main Entry Point)
- Video Translation Service
- YouTube Download Service
- Image Translation Service

##### External Services Integration
- Yandex Video Translation API
- Yandex OCR Translation Service
- YouTube-DL Integration
- Telegram API
- FFmpeg Processing

##### Component Relationships

**User/Telegram -> Telegram Bot Service -> Video Processing Pipeline**
- > Image Processing Pipeline

##### Detailed Service Breakdown

a) Telegram Bot Service (Main Container):
- Bot Client Component
- Handler Component
- Notification System
- Throttler

b) Video Processing Pipeline:
- YouTube Downloader Service (ytdl-service)
- Video Translation Service (video-translate-server)
- FFmpeg Processing Module

c) Image Processing Pipeline:
- Image Translation Service
- OCR Processing
- Thumbnail Management

##### Technical Details

- Serverless deployment (indicated by serverless.yml files)
- Docker containerization (shown by Dockerfile presence)
- Environment configuration flow
- API communication paths

##### Use standardized symbols
- Rectangles for services
- Hexagons for external APIs

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Legend
        direction TB
        L1[Service]:::service
        L2[External API]:::api
        L3[(Storage)]:::storage
        L4[Processing]:::processing
    end

    subgraph "User Interface"
        User([User])
        TelegramAPI[Telegram API]:::api
    end

    subgraph "Core Services"
        direction TB
        BotService[Telegram Bot Service]:::service
        BotClient[Bot Client]:::component
        Handler[Handler]:::component
        Notification[Notification System]:::component
        Throttler[Throttler]:::component
        TelegramClient[Telegram Client]:::component
        Logger[Logger]:::component
    end

    subgraph "Video Processing"
        direction TB
        YTDLService[YouTube Download Service]:::service
        VideoTransService[Video Translation Service]:::service
        FFmpeg[FFmpeg Processing]:::processing
    end

    subgraph "Image Processing"
        direction TB
        ImageTransService[Image Translation Service]:::service
        OCRProcess[OCR Processing]:::processing
        ThumbManage[Thumbnail Management]:::processing
    end

    subgraph "External Services"
        direction TB
        YandexVideo[Yandex Video API]:::api
        YandexOCR[Yandex OCR API]:::api
        YouTubeDL[YouTube-DL]:::api
    end

    User --> TelegramAPI
    TelegramAPI --> BotService

    BotService --> BotClient
    BotService --> Handler
    BotService --> Notification
    BotService --> Throttler
    BotService --> TelegramClient
    BotService --> Logger

    BotService --> YTDLService
    BotService --> VideoTransService
    BotService --> ImageTransService

    YTDLService --> YouTubeDL
    YTDLService --> FFmpeg

    VideoTransService --> YandexVideo
    VideoTransService --> FFmpeg

    ImageTransService --> YandexOCR
    ImageTransService --> OCRProcess
    ImageTransService --> ThumbManage

    %% Click Events
    click BotService "https://github.com/nezort11/video-translate-bot/tree/master/src"
    click BotClient "https://github.com/nezort11/video-translate-bot/blob/master/src/botclient.ts"
    click Handler "https://github.com/nezort11/video-translate-bot/blob/master/src/handler.ts"
    click Notification "https://github.com/nezort11/video-translate-bot/blob/master/src/notification.ts"
    click Throttler "https://github.com/nezort11/video-translate-bot/blob/master/src/throttler.ts"
    click TelegramClient "https://github.com/nezort11/video-translate-bot/blob/master/src/telegramclient.ts"
    click Logger "https://github.com/nezort11/video-translate-bot/blob/master/src/telegramlogger.ts"
    click VideoTransService "https://github.com/nezort11/video-translate-bot/tree/master/packages/video-translate-server"
    click YTDLService "https://github.com/nezort11/video-translate-bot/tree/master/packages/ytdl-service"
    click ImageTransService "https://github.com/nezort11/video-translate-bot/tree/master/image-translate"

    classDef service fill:#3498db,stroke:#2980b9,color:white
    classDef api fill:#2ecc71,stroke:#27ae60,color:white
    classDef storage fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef processing fill:#f1c40f,stroke:#f39c12,color:black
    classDef component fill:#e74c3c,stroke:#c0392b,color:white
```
