# dev-armaan/ai-interviewer architecture

> Architecture diagram of the GitHub repository dev-armaan/ai-interviewer, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/dev-armaan/ai-interviewer
- Repository: https://github.com/dev-armaan/ai-interviewer

## Overview

##### Main Components
- Frontend Client: This is built with React and styled with Tailwind CSS. It handles the user interface (UI), user interactions, and communicates with the backend API.
- Backend API Server: Implemented in Python using Flask, this component manages core functionalities such as processing interview data, handling file uploads (resumes and audio files), performing audio transcription (via audio_transcription.py), and interfacing with external AI services.
- Database: Although the README mentions MySQL and MongoDB as part of the tech stack, the file tree indicates the use of SQLite (the ai_interview_bot.db file). Represent the database as a persistent storage component holding interview data, user session information, and possibly uploaded files.
- File and Asset Management: The system handles resume uploads and audio files. There’s a dedicated “uploads” folder, and the backend directory also contains an “uploads” subfolder. Capture this as part of file storage and how it’s accessed by the backend.

##### Relationships and Interactions
- The Frontend sends HTTP requests (API calls) to the Backend API Server.
- The Backend processes these requests, performs logic (e.g., triggers a mock interview session), and, if needed, interacts with external AI services.
- The backend reads from/writes to the database to store interview data, user progress, and other relevant information.
- File uploads from the user (resumes, audio snippets) are handled by the backend, which then may preprocess these (transcription, etc.) before further processing.
- External API call flows: The backend communicates with APIs like OpenAI for feedback generation and Cohere for natural language processing tasks.

##### Architectural Patterns and Design Principles
- Separation of Concerns: Distinguish clearly between frontend and backend functionalities.
- Modular Design: The backend is divided into modules (e.g., app.py as the main server, separate modules for database models, API integrations, audio transcription, configuration, etc.).

##### Relevant Technologies and Frameworks
- Frontend: React.js, Tailwind CSS, Vite.
- Backend: Python Flask, SQLite for local database management (despite README mentioning MySQL/MongoDB, SQLite is evident in the file tree).
- External Services: OpenAI API, Cohere API (and mention potential integration with GCP).
- Supporting Libraries: OpenCV (likely for video or image processing) and Recharts (for rendering progress analytics).

##### Instructing the Principal Software Engineer
– The HTTP/REST communication from the Frontend to the Backend.
– The Backend’s dependencies on the Database.
– The flows between the Backend and External APIs for tasks like AI feedback and audio transcription.
– The flow for handling user uploads from the Frontend to the backend’s file storage.
– Rectangles for services (frontend, backend),

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client Layer
    subgraph "Client Layer"
        FE["Frontend (React + Tailwind)"]:::frontend
    end

    %% Backend Services
    subgraph "Backend Services"
        BE["Backend API Server (Flask)"]:::backend
        AT["Audio Transcription Module"]:::backend
        CA["Cohere API Integration Module"]:::backend
        DB["Database (SQLite)"]:::database
    end

    %% File and Asset Management
    subgraph "File and Asset Management"
        BU["Backend Uploads"]:::backend
        RU["Root Uploads"]:::backend
    end

    %% External Services
    subgraph "External Services"
        OAI["OpenAI API"]:::external
        CAExt["Cohere API"]:::external
        GCP["GCP API"]:::external
    end

    %% Connections
    FE -->|"API_Request"| BE
    BE -->|"Data_Fetch/Store"| DB
    BE -->|"Audio_Processing"| AT
    BE -->|"NLP_Integration"| CA
    BE -->|"File_Upload"| BU
    BE -->|"AI_Feedback"| OAI
    BE -->|"AI_Tasks"| CAExt
    BE -->|"Cloud_Tasks"| GCP

    %% Click Events
    click FE "https://github.com/dev-armaan/ai-interviewer/tree/main/frontend/"
    click BE "https://github.com/dev-armaan/ai-interviewer/blob/main/backend/app.py"
    click DB "https://github.com/dev-armaan/ai-interviewer/blob/main/backend/ai_interview_bot.db"
    click AT "https://github.com/dev-armaan/ai-interviewer/blob/main/backend/audio_transcription.py"
    click CA "https://github.com/dev-armaan/ai-interviewer/blob/main/backend/cohere_api.py"
    click BU "https://github.com/dev-armaan/ai-interviewer/tree/main/backend/uploads/"
    click RU "https://github.com/dev-armaan/ai-interviewer/tree/main/uploads/"

    %% Styles
    classDef frontend fill:#a6cee3,stroke:#1f78b4,stroke-width:2px;
    classDef backend fill:#b2df8a,stroke:#33a02c,stroke-width:2px;
    classDef database fill:#cccccc,stroke:#666666,stroke-width:2px;
    classDef external fill:#fdbf6f,stroke:#ff7f00,stroke-width:2px;
```
