# kamo-chip/shorts-bot-backend architecture

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

- Interactive diagram: https://gitdiagram.com/kamo-chip/shorts-bot-backend
- Repository: https://github.com/kamo-chip/shorts-bot-backend

## Overview

##### Main System Components

a) Application Server Layer:
- Express.js server (server.js)
- Utility functions (utils.js)

b) External Services:
- ElevenLabs API (for voice/audio processing)
- OpenAI API (likely for text generation or processing)
- AWS Services:
- S3 (for storing video files)
- DynamoDB (for data persistence)

c) Local Storage Components:
- assets folder (for background clips and music)
- generated-clips (for processed video outputs)
- generated-subtitles (for subtitle files)

- [Client Layer]
- ↕
- [Express Server Layer]
- ↕
- [Service Integration Layer]
- ↙     ↓     ↘
- [AWS]  [OpenAI]  [ElevenLabs]

##### Component Relationships to Highlight

- Bidirectional flow between the Express server and external services
- File I/O operations between the server and local storage directories
- Demonstrate the data flow from input assets to generated outputs

##### Specific Elements

a) Input/Output Flow:
- Assets folder → Server Processing → Generated Clips/Subtitles
- Clear indication of video and subtitle file generation paths

b) External Service Integration:
- AWS S3 for video storage
- DynamoDB for data persistence
- ElevenLabs for audio processing
- OpenAI for potential text/content generation

##### Technical Details to Note

- Environment configuration requirements
- API integration points
- File format handling (.mp4, .srt)
- Asynchronous processing flows

- Use rectangles for services and components

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "Client Layer"
        Client[Client Application]
    end

    subgraph "Application Server Layer"
        Server["Express Server"]:::server
        Utils["Utility Functions"]:::utils
    end

    subgraph "Service Integration Layer"
        subgraph "AWS Services"
            S3["AWS S3"]:::aws
            DynamoDB["DynamoDB"]:::aws
        end
        
        subgraph "AI Services"
            OpenAI["OpenAI API"]:::ai
            ElevenLabs["ElevenLabs API"]:::ai
        end
    end

    subgraph "Storage Layer"
        Assets["Assets Directory"]:::storage
        GenClips["Generated Clips"]:::storage
        GenSubs["Generated Subtitles"]:::storage
        VideoOut["Video Output (.mp4)"]:::file
        SubOut["Subtitle Output (.srt)"]:::file
    end

    Client <--> Server
    Server <--> Utils
    
    Server --> S3
    Server --> DynamoDB
    Server --> OpenAI
    Server --> ElevenLabs
    
    Assets --> Server
    Server --> GenClips
    Server --> GenSubs
    GenClips --> VideoOut
    GenSubs --> SubOut

    %% Styles
    classDef server fill:#3498db,stroke:#2980b9,color:white
    classDef utils fill:#3498db,stroke:#2980b9,color:white
    classDef aws fill:#2ecc71,stroke:#27ae60,color:white
    classDef ai fill:#9b59b6,stroke:#8e44ad,color:white
    classDef storage fill:#f1c40f,stroke:#f39c12,color:black
    classDef file fill:#95a5a6,stroke:#7f8c8d,color:white

    %% Click Events
    click Server "https://github.com/Kamo-Chip/shorts-bot-backend/blob/main/server.js"
    click Utils "https://github.com/Kamo-Chip/shorts-bot-backend/blob/main/utils.js"
    click GenClips "https://github.com/Kamo-Chip/shorts-bot-backend/tree/main/generated-clips"
    click GenSubs "https://github.com/Kamo-Chip/shorts-bot-backend/tree/main/generated-subtitles"
    click VideoOut "https://github.com/Kamo-Chip/shorts-bot-backend/blob/main/generated-clips/afeddd08-07a3-498e-b1d3-fcc12e46b6bb.mp4"
    click SubOut "https://github.com/Kamo-Chip/shorts-bot-backend/blob/main/generated-subtitles/fc4725f1-9417-4def-bb40-e243abfa3738.srt"
```
