# shobhitkori/voice-to-code architecture

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

- Interactive diagram: https://gitdiagram.com/shobhitkori/voice-to-code
- Repository: https://github.com/shobhitkori/voice-to-code

## Overview

##### Project type and purpose
- This is a full-stack web application called “Voice-to-Code” that enables users to upload or record audio, transcribe their speech into text, and convert that text into executable source code.
- The root README, plus two parallel “client” directories and a “backend” directory, make it clear that there is a front-end web interface built in Next.js/React/TypeScript and a back-end service in Python using machine-learning models (Whisper for transcription, CodeT5 for code generation).

##### File structure
- Top-level folders:
- backend: Python service with main.py (FastAPI/Uvicorn entry point), codet5_model.py, whisper_model.py, utils.py, ffmpeg_test.py, Dockerfile, requirements.txt
- client and client-2: two nearly identical Next.js TypeScript apps (likely a v1/v2 layout) with app/ pages, components/ (AudioUpload.tsx, theme provider, UI library), tailwind and PostCSS configs
- Configuration/build files:
- backend/Dockerfile, .gitignore, requirements.txt
- client-*/package.json, tsconfig.json, next.config.ts, tailwind.config.ts, eslint.config.mjs
- No persistent database or external data store is present—state is passed in memory/request.

##### README for additional insights
- The Overview section details the core workflow: user speaks or uploads audio → backend processes audio → speech-to-text (Whisper) → text-to-code (CodeT5) → result returned to UI.
- Dependencies: Python, FastAPI (implied by uvicorn), React/Next.js/TypeScript, Tailwind CSS.

## Diagram (Mermaid)

```mermaid
graph TD
    %% Frontend Layer
    subgraph "Frontend Layer"
        direction TB
        Browser["User Browser"]:::external
        subgraph "Next.js Web UI (client-2)" 
            direction TB
            Page["app/pages"]:::frontend
            Layout["app/layout"]:::frontend
            AudioUpload["AudioUpload Component"]:::frontend
            UIButton["UI Button (ui/button)"]:::frontend
            TailwindCfg["tailwind.config.ts"]:::frontend
            NextConfig["next.config.ts"]:::frontend
        end
    end

    %% Backend Service
    subgraph "Backend Service"
        direction TB
        FastAPI["FastAPI Server (main.py)"]:::backend

        subgraph "Audio Processing Subsystem"
            direction TB
            FFMPEG["ffmpeg Converter"]:::backend
            Utils["Utilities (utils.py)"]:::backend
        end

        subgraph "Machine Learning Subsystem"
            direction TB
            Whisper["WhisperModel (whisper_model.py)"]:::backend
            CodeT5["CodeT5Model (codet5_model.py)"]:::backend
        end
    end

    %% Deployment Infrastructure
    subgraph "Deployment Configuration"
        direction TB
        Docker["Docker Container"]:::infra
        Requirements["requirements.txt"]:::infra
        Gitignore[".gitignore"]:::infra
    end

    %% Connections
    Browser -->|"HTTPS request"| Page
    Page -->|uses UI components| AudioUpload
    AudioUpload -->|uploads audio| FastAPI
    FastAPI -->|calls ffmpeg| FFMPEG
    FFMPEG -->|uses utils| Utils
    FFMPEG -->|normalized audio| Whisper
    Whisper -->|transcribed text| CodeT5
    CodeT5 -->|generated code| FastAPI
    FastAPI -->|JSON response| Page
    Docker --> FastAPI
    Docker --> Requirements
    Docker --> Gitignore

    %% Click Events
    click Page "https://github.com/shobhitkori/voice-to-code/blob/main/client-2/app/page.tsx"
    click Layout "https://github.com/shobhitkori/voice-to-code/blob/main/client-2/app/layout.tsx"
    click AudioUpload "https://github.com/shobhitkori/voice-to-code/blob/main/client-2/components/AudioUpload.tsx"
    click UIButton "https://github.com/shobhitkori/voice-to-code/blob/main/client-2/components/ui/button.tsx"
    click TailwindCfg "https://github.com/shobhitkori/voice-to-code/blob/main/client-2/tailwind.config.ts"
    click NextConfig "https://github.com/shobhitkori/voice-to-code/blob/main/client-2/next.config.ts"
    click FastAPI "https://github.com/shobhitkori/voice-to-code/blob/main/backend/main.py"
    click FFMPEG "https://github.com/shobhitkori/voice-to-code/blob/main/backend/ffmpeg_test.py"
    click Utils "https://github.com/shobhitkori/voice-to-code/blob/main/backend/utils.py"
    click Whisper "https://github.com/shobhitkori/voice-to-code/blob/main/backend/whisper_model.py"
    click CodeT5 "https://github.com/shobhitkori/voice-to-code/blob/main/backend/codet5_model.py"
    click Docker "https://github.com/shobhitkori/voice-to-code/tree/main/backend/Dockerfile"
    click Requirements "https://github.com/shobhitkori/voice-to-code/blob/main/backend/requirements.txt"
    click Gitignore "https://github.com/shobhitkori/voice-to-code/blob/main/backend/.gitignore"

    %% Styles
    classDef frontend fill:#bbdefb,stroke:#333,stroke-width:1px
    classDef backend fill:#c8e6c9,stroke:#333,stroke-width:1px
    classDef infra fill:#e0e0e0,stroke:#333,stroke-width:1px
    classDef external fill:#ffe0b2,stroke:#333,stroke-width:1px
```
