# utsavbhardwaj/interviewai architecture

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

- Interactive diagram: https://gitdiagram.com/utsavbhardwaj/interviewai
- Repository: https://github.com/utsavbhardwaj/interviewai

## Overview

##### Project type and purpose
- This is a full-stack web application (“Interview AI”) for practicing mock interviews using AI-generated questions and real-time voice/video interaction.
- Frontend: React + TypeScript, Vite, Tailwind CSS, Shadcn/UI, Wouter, TanStack Query, browser media APIs.
- Backend: Node.js + Express in TypeScript, Drizzle ORM + PostgreSQL (Neon), Multer for uploads, session store via connect-pg-simple, custom storage, AI services integration (Gemini, Deepseek).

##### File structure
- Top-level “client” and “server” directories indicate a clear frontend/backend separation.
- “client/src/components” subdivides UI, feedback, interview modules—suggests component-based design.
- “client/src/hooks” encapsulate media and AI-interaction logic.
- “server” folder contains index.ts (app entry), routes.ts (API layer), services/ (AI integration), db.ts (Drizzle setup), storage.ts, vite.ts (for hot-reload).
- Shared schema in “shared/schema.ts” centralizes database models.
- Config files for Drizzle, Vite, Tailwind, PostCSS, TS config reflect modern build pipeline.

##### README for additional insights
- README explicitly calls out a three-layer architecture: Frontend, Backend, Data & Storage.
- Mentions external AI services (Google Gemini), PostgreSQL on Neon, in-memory file uploads, session persistence, security and performance optimizations.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Layer
    subgraph "Frontend" 
        direction TB
        FE_HTML["HTML Template"]:::frontend
        FE_VITE["Vite Config"]:::frontend
        FE_MAIN["Entry Point<br/>client/src/main.tsx"]:::frontend
        FE_APP["React App<br/>client/src/App.tsx"]:::frontend
        subgraph "UI Library"
            direction TB
            UI_LIB["Shadcn/UI Primitives<br/>client/src/components/ui/"]:::frontend
            NAV["Navigation Layout<br/>client/src/components/layout/navigation.tsx"]:::frontend
        end
        subgraph "Pages"
            direction TB
            P_HOME["Home Page<br/>client/src/pages/home.tsx"]:::frontend
            P_DASH["Dashboard Page<br/>client/src/pages/dashboard.tsx"]:::frontend
            P_INTERVIEW["Interview Page<br/>client/src/pages/interview.tsx"]:::frontend
            P_FEEDBACK["Feedback Page<br/>client/src/pages/feedback.tsx"]:::frontend
            P_SIGNIN["Sign-In Page<br/>client/src/pages/sign-in.tsx"]:::frontend
            P_SIGNUP["Sign-Up Page<br/>client/src/pages/sign-up.tsx"]:::frontend
            P_NOTFOUND["Not-Found Page<br/>client/src/pages/not-found.tsx"]:::frontend
        end
        subgraph "Interview Components"
            direction TB
            Q_PROGRESS["Question Progress<br/>client/src/components/interview/question-progress.tsx"]:::frontend
            SR_UI["Speech Recognition UI<br/>client/src/components/interview/speech-recognition.tsx"]:::frontend
            VID_IF["Video Interface<br/>client/src/components/interview/video-interface.tsx"]:::frontend
        end
        subgraph "Feedback Components"
            direction TB
            PERF_CHART["Performance Chart<br/>client/src/components/feedback/performance-chart.tsx"]:::frontend
        end
        subgraph "Hooks & Data"
            direction TB
            HW_CAM["use-webcam<br/>client/src/hooks/use-webcam.ts"]:::frontend
            HW_SR["use-speech-recognition<br/>client/src/hooks/use-speech-recognition.ts"]:::frontend
            HW_TTS["use-text-to-speech<br/>client/src/hooks/use-text-to-speech.ts"]:::frontend
            HW_AS["use-advanced-speech<br/>client/src/hooks/use-advanced-speech.ts"]:::frontend
            QC["QueryClient<br/>client/src/lib/queryClient.ts"]:::frontend
        end
    end

    %% Backend Layer
    subgraph "Backend" 
        direction TB
        BE_VITE["Vite Config (Hot-Reload)<br/>server/vite.ts"]:::backend
        BE_INDEX["Express API<br/>server/index.ts"]:::backend
        BE_ROUTES["Routes<br/>server/routes.ts"]:::backend
        BE_MW["Middleware<br/>middleware.ts"]:::backend
        subgraph "Database Layer"
            direction TB
            DB_SETUP["Drizzle Setup<br/>server/db.ts"]:::database
            DB_CFG["Drizzle Config<br/>drizzle.config.ts"]:::database
            SCHEMA["Shared Schema<br/>shared/schema.ts"]:::database
        end
        STORAGE["Storage Layer<br/>server/storage.ts"]:::database
    end

    %% External AI Services
    subgraph "AI Services"
        direction TB
        GPT["Gemini API Service<br/>server/services/gemini.ts"]:::ai
        DEEP["Deepseek API Service<br/>server/services/deepseek.ts"]:::ai
    end

    %% Data Flow
    User["User"]:::external
    User -->|"interacts via browser"| FE_HTML
    FE_HTML --> FE_MAIN
    FE_MAIN --> FE_APP
    FE_APP --> UI_LIB
    FE_APP --> P_HOME
    FE_APP --> P_DASH
    FE_APP --> P_INTERVIEW
    FE_APP --> P_FEEDBACK
    FE_APP --> P_SIGNIN
    FE_APP --> P_SIGNUP
    FE_APP --> P_NOTFOUND
    P_INTERVIEW --> Q_PROGRESS
    P_INTERVIEW --> SR_UI
    P_INTERVIEW --> VID_IF
    P_FEEDBACK --> PERF_CHART
    FE_APP --> HW_CAM
    FE_APP --> HW_SR
    FE_APP --> HW_TTS
    FE_APP --> HW_AS
    FE_APP --> QC
    QC -->|REST API calls| BE_INDEX
    BE_INDEX --> BE_MW
    BE_MW --> BE_ROUTES
    BE_ROUTES --> DB_SETUP
    BE_ROUTES --> STORAGE
    BE_ROUTES --> GPT
    BE_ROUTES --> DEEP
    GPT -->|"generate questions"| BE_ROUTES
    DEEP -->|"analyze transcript"| BE_ROUTES
    STORAGE --> DB_SETUP
    DB_SETUP --> DB_CFG
    DB_SETUP --> SCHEMA

    %% Click Events
    click FE_MAIN "https://github.com/utsavbhardwaj/interviewai/blob/main/client/src/main.tsx"
    click FE_HTML "https://github.com/utsavbhardwaj/interviewai/blob/main/client/index.html"
    click FE_VITE "https://github.com/utsavbhardwaj/interviewai/blob/main/vite.config.ts"
    click FE_APP "https://github.com/utsavbhardwaj/interviewai/blob/main/client/src/App.tsx"
    click P_HOME "https://github.com/utsavbhardwaj/interviewai/blob/main/client/src/pages/home.tsx"
    click P_DASH "https://github.com/utsavbhardwaj/interviewai/blob/main/client/src/pages/dashboard.tsx"
    click P_INTERVIEW "https://github.com/utsavbhardwaj/interviewai/blob/main/client/src/pages/interview.tsx"
    click P_FEEDBACK "https://github.com/utsavbhardwaj/interviewai/blob/main/client/src/pages/feedback.tsx"
    click P_SIGNIN "https://github.com/utsavbhardwaj/interviewai/blob/main/client/src/pages/sign-in.tsx"
    click P_SIGNUP "https://github.com/utsavbhardwaj/interviewai/blob/main/client/src/pages/sign-up.tsx"
    click P_NOTFOUND "https://github.com/utsavbhardwaj/interviewai/blob/main/client/src/pages/not-found.tsx"
    click UI_LIB "https://github.com/utsavbhardwaj/interviewai/tree/main/client/src/components/ui/"
    click NAV "https://github.com/utsavbhardwaj/interviewai/blob/main/client/src/components/layout/navigation.tsx"
    click Q_PROGRESS "https://github.com/utsavbhardwaj/interviewai/blob/main/client/src/components/interview/question-progress.tsx"
    click SR_UI "https://github.com/utsavbhardwaj/interviewai/blob/main/client/src/components/interview/speech-recognition.tsx"
    click VID_IF "https://github.com/utsavbhardwaj/interviewai/blob/main/client/src/components/interview/video-interface.tsx"
    click PERF_CHART "https://github.com/utsavbhardwaj/interviewai/blob/main/client/src/components/feedback/performance-chart.tsx"
    click HW_CAM "https://github.com/utsavbhardwaj/interviewai/blob/main/client/src/hooks/use-webcam.ts"
    click HW_SR "https://github.com/utsavbhardwaj/interviewai/blob/main/client/src/hooks/use-speech-recognition.ts"
    click HW_TTS "https://github.com/utsavbhardwaj/interviewai/blob/main/client/src/hooks/use-text-to-speech.ts"
    click HW_AS "https://github.com/utsavbhardwaj/interviewai/blob/main/client/src/hooks/use-advanced-speech.ts"
    click QC "https://github.com/utsavbhardwaj/interviewai/blob/main/client/src/lib/queryClient.ts"
    click BE_INDEX "https://github.com/utsavbhardwaj/interviewai/blob/main/server/index.ts"
    click BE_ROUTES "https://github.com/utsavbhardwaj/interviewai/blob/main/server/routes.ts"
    click BE_MW "https://github.com/utsavbhardwaj/interviewai/blob/main/middleware.ts"
    click DB_SETUP "https://github.com/utsavbhardwaj/interviewai/blob/main/server/db.ts"
    click DB_CFG "https://github.com/utsavbhardwaj/interviewai/blob/main/drizzle.config.ts"
    click SCHEMA "https://github.com/utsavbhardwaj/interviewai/blob/main/shared/schema.ts"
    click STORAGE "https://github.com/utsavbhardwaj/interviewai/blob/main/server/storage.ts"
    click GPT "https://github.com/utsavbhardwaj/interviewai/blob/main/server/services/gemini.ts"
    click DEEP "https://github.com/utsavbhardwaj/interviewai/blob/main/server/services/deepseek.ts"
    click BE_VITE "https://github.com/utsavbhardwaj/interviewai/blob/main/server/vite.ts"

    %% Styles
    classDef frontend fill:#D0E8FF,stroke:#0366d6,color:#0366d6;
    classDef backend fill:#DFFFE0,stroke:#22863A,color:#22863A;
    classDef database fill:#FFF4DB,stroke:#D18616,color:#D18616;
    classDef ai fill:#F0E0FF,stroke:#6F42C1,color:#6F42C1;
    classDef external fill:#FFFFFF,stroke:#666666,color:#666666,stroke-dasharray: 5 5;
```
