# pranavreddygaddam/gittranslate architecture

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

- Interactive diagram: https://gitdiagram.com/pranavreddygaddam/gittranslate
- Repository: https://github.com/pranavreddygaddam/gittranslate

## Overview

##### Project Type and Purpose
- This is a full-stack web application (“GitTranslate”) that enables users to fetch code repositories, translate comments/documentation via OpenAI’s GPT-3.5 Turbo, transcribe and translate audio files using Whisper, and synthesize new audio via TTS. It also provides automation via an Orkes workflow script.

##### File Structure Analysis
- Top-level directories:
- backend/ – Python FastAPI service
- frontend/ – Next.js + React + TypeScript UI
- scripts/ – Python scripts for automation and Orkes workflow
- backend/app/routes, services, utils – clear separation of API endpoints, business logic, and helper modules
- frontend/src/components, api, lib – component library, API client, utility functions
- Config files: requirements.txt, package.json, .env files, Vite and Tailwind configs
- No persistent database folder – the system relies on external APIs and temp storage.

##### README Insights
- Frontend deploys on Vercel, backend runs on Uvicorn/FastAPI
- External dependencies: GitHub/GitLab APIs, OpenAI (GPT, Whisper), TTS engine, Orkes for workflow orchestration
- Main flows: repository fetch → translation → response to UI; audio upload → transcription → translation → synthesis.

##### Relationships & Data Flow
- GitHub/GitLab APIs (fetch code/comments)
- OpenAI GPT API (translate text)
- Whisper (transcribe audio)
- TTS (synthesize translated audio)
- Orkes engine (via orkes-fe-script.py)

##### Architectural Patterns & Design Principles
- Clear separation of concerns:
- Presentation (frontend components)
- API layer (FastAPI routes)
- Business logic (services)
- Utility modules (config, helpers)
- Modular, script-based automation for workflows
- Environment-driven configuration (.env files)
- Stateless backend relying on external services

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client/UI Zone
    subgraph "Client/UI Zone"
        Browser["Browser"]:::frontend
    end

    %% Frontend Server Zone
    subgraph "Frontend Server Zone"
        NextJS["Next.js Server"]:::frontend
        subgraph "UI Components"
            RepoInput["RepoInputCard"]:::frontend
            AudioPlayer["AudioPlayer"]:::frontend
            Constellation["ConstellationCanvas"]:::frontend
            Navbar["Navbar"]:::frontend
            UIPRIM["Shared UI Primitives"]:::frontend
        end
        APIclient["API Client"]:::frontend
        Utils["utils.ts"]:::frontend
        Validation["validation.ts"]:::frontend
    end

    %% Backend API Zone
    subgraph "Backend API Zone"
        MainApp["main.py"]:::backend
        FastAPI["FastAPI Server"]:::backend
        subgraph "Routes"
            Generate["generate.py"]:::backend
            Status["status.py"]:::backend
        end
        OrkesService["orkes.py"]:::backend
        Config["config.py"]:::backend
    end

    %% Automation/Scripts Zone
    subgraph "Automation/Scripts Zone"
        OrkesFE["orkes-fe-script.py"]:::scripts
        OrkesAlt["orks_script.py"]:::scripts
        ScriptsUtils["utils.py"]:::scripts
        FetchRepo["fetch_repo_data.py"]:::scripts
        Summarize["summarize_repo.py"]:::scripts
        TranslateScript["translate_script.py"]:::scripts
        TTSscript["text2speech.py"]:::scripts
        Podcast["generate_podcast.py"]:::scripts
        ReturnAudio["return_audio_url.py"]:::scripts
    end

    %% External Services Zone
    subgraph "External Services Zone"
        GitAPI["GitHub/GitLab APIs"]:::external
        GPT["OpenAI GPT-3.5 Turbo"]:::external
        Whisper["Whisper Transcription"]:::external
        TTSsvc["TTS Service"]:::external
        OrkesEngine["Orkes Workflow Engine"]:::external
    end

    %% Connections
    Browser -->|"Page load/User input"| NextJS
    NextJS -->|"API requests"| FastAPI
    NextJS -->|uses| RepoInput
    NextJS -->|uses| AudioPlayer
    NextJS -->|uses| Constellation
    NextJS -->|uses| Navbar
    NextJS -->|uses| UIPRIM
    NextJS -->|uses| APIclient
    NextJS -->|uses| Utils
    NextJS -->|uses| Validation

    FastAPI -->|"entry point"| MainApp
    FastAPI -->|"route"| Generate
    FastAPI -->|"route"| Status
    Generate -->|calls| OrkesService
    Status -->|calls| OrkesService
    FastAPI -->|uses| Config
    FastAPI -->|fetch repo| GitAPI
    FastAPI -->|translate text| GPT
    FastAPI -->|transcribe audio| Whisper
    FastAPI -->|synthesize audio| TTSsvc
    FastAPI -->|trigger workflow| OrkesEngine

    GitAPI -->|response| FastAPI
    GPT -->|response| FastAPI
    Whisper -->|response| FastAPI
    TTSsvc -->|response| FastAPI
    OrkesEngine -->|workflow result| FastAPI
    FastAPI -->|"JSON response"| NextJS
    NextJS -->|"Update UI"| Browser

    OrkesFE -->|orchestrates| OrkesEngine
    OrkesFE -->|calls| FetchRepo
    OrkesFE -->|calls| Summarize
    OrkesFE -->|calls| TranslateScript
    OrkesFE -->|calls| TTSscript
    OrkesFE -->|calls| Podcast
    OrkesFE -->|calls| ReturnAudio
    OrkesAlt -->|alternate| OrkesEngine

    %% Click Events
    click RepoInput "https://github.com/pranavreddygaddam/gittranslate/blob/main/frontend/src/components/RepoInputCard.tsx"
    click AudioPlayer "https://github.com/pranavreddygaddam/gittranslate/blob/main/frontend/src/components/AudioPlayer.tsx"
    click Constellation "https://github.com/pranavreddygaddam/gittranslate/blob/main/frontend/src/components/ConstellationCanvas.tsx"
    click Navbar "https://github.com/pranavreddygaddam/gittranslate/blob/main/frontend/src/components/Navbar.tsx"
    click UIPRIM "https://github.com/pranavreddygaddam/gittranslate/tree/main/frontend/src/components/ui"
    click APIclient "https://github.com/pranavreddygaddam/gittranslate/blob/main/frontend/src/api/index.ts"
    click Utils "https://github.com/pranavreddygaddam/gittranslate/blob/main/frontend/src/lib/utils.ts"
    click Validation "https://github.com/pranavreddygaddam/gittranslate/blob/main/frontend/src/lib/validation.ts"
    click MainApp "https://github.com/pranavreddygaddam/gittranslate/blob/main/backend/app/main.py"
    click Generate "https://github.com/pranavreddygaddam/gittranslate/blob/main/backend/app/routes/generate.py"
    click Status "https://github.com/pranavreddygaddam/gittranslate/blob/main/backend/app/routes/status.py"
    click OrkesService "https://github.com/pranavreddygaddam/gittranslate/blob/main/backend/app/services/orkes.py"
    click Config "https://github.com/pranavreddygaddam/gittranslate/blob/main/backend/app/utils/config.py"
    click OrkesFE "https://github.com/pranavreddygaddam/gittranslate/blob/main/orkes-fe-script.py"
    click OrkesAlt "https://github.com/pranavreddygaddam/gittranslate/blob/main/scripts/orkes_script.py"
    click ScriptsUtils "https://github.com/pranavreddygaddam/gittranslate/blob/main/scripts/utils.py"
    click FetchRepo "https://github.com/pranavreddygaddam/gittranslate/blob/main/scripts/fetch_repo_data.py"
    click Summarize "https://github.com/pranavreddygaddam/gittranslate/blob/main/scripts/summarize_repo.py"
    click TranslateScript "https://github.com/pranavreddygaddam/gittranslate/blob/main/scripts/translate_script.py"
    click TTSscript "https://github.com/pranavreddygaddam/gittranslate/blob/main/scripts/text2speech.py"
    click Podcast "https://github.com/pranavreddygaddam/gittranslate/blob/main/scripts/generate_podcast.py"
    click ReturnAudio "https://github.com/pranavreddygaddam/gittranslate/blob/main/scripts/return_audio_url.py"

    %% Styles
    classDef frontend fill:#cce5ff,stroke:#0366d6,color:#000;
    classDef backend fill:#d4edda,stroke:#28a745,color:#000;
    classDef scripts fill:#ffe5b4,stroke:#d2691e,color:#000;
    classDef external fill:#e2e3e5,stroke:#6c757d,color:#000;
```
