# thdwlndjs/interviewiq architecture

> Architecture diagram of the GitHub repository thdwlndjs/interviewiq, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/thdwlndjs/interviewiq
- Repository: https://github.com/thdwlndjs/interviewiq

## Overview

InterviewIQ is an AI mock-interview coaching app. A user starts a session, answers while the browser analyzes webcam frames and sends vision chunks, then finishes each answer to upload audio and request transcription, analysis, and the next question. The backend stores session and answer state, uses RAG context and question generation, and exposes answer analysis and a final report. The README documents frontend-to-backend behavior; the graph also uses source-index references and excerpts. Some frontend API wiring and unsampled implementation details are not shown, so those links are documented rather than inferred from imports.

Main entry points: [`app/api/sessions.py`](https://github.com/thdwlndjs/interviewiq/blob/main/app/api/sessions.py) (Session API), [`frontend/lib/analysis/interviewBehaviorAnalyzer.ts`](https://github.com/thdwlndjs/interviewiq/blob/main/frontend/lib/analysis/interviewBehaviorAnalyzer.ts) (Behavior analysis), [`app/core/config.py`](https://github.com/thdwlndjs/interviewiq/blob/main/app/core/config.py) (Runtime settings), [`frontend/app/page.tsx`](https://github.com/thdwlndjs/interviewiq/blob/main/frontend/app/page.tsx) (Interview UI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Interview client"]
  node_interview_ui["Interview UI<br/>[page.tsx]"]
  node_session_context["Session state"]
  node_camera["Camera capture<br/>[Camera.tsx]"]
  node_camera_hook["Camera stream<br/>[useCamera.ts]"]
end

subgraph group_vision["Vision analysis"]
  node_mediapipe["Landmark detection<br/>[useMediaPipe.ts]"]
  node_behavior["Behavior analysis"]
  node_gaze["Gaze analysis<br/>[gazeAnalyzer.ts]"]
  node_gesture["Gesture analysis<br/>[gestureAnalyzer.ts]"]
  node_posture["Posture analysis<br/>[postureAnalyzer.ts]"]
  node_events["Behavior events<br/>[events.ts]"]
  node_math["Signal math<br/>[math.ts]"]
end

subgraph group_session["Session backend"]
  node_session_api["Session API<br/>[sessions.py]"]
  node_chunk_schema["Chunk schema<br/>[chunk.py]"]
  node_session_schema["Session schema<br/>[session.py]"]
  node_report["Summary report<br/>[page.tsx]"]
end

subgraph group_intelligence["Interview intelligence"]
  node_transcriber["Audio transcription<br/>[transcriber.py]"]
  node_rag["RAG retrieval<br/>[retriever.py]"]
  node_rag_loader["RAG documents<br/>[loader.py]"]
  node_question_gen["Question generation"]
end

subgraph group_persistence["Persistence"]
  node_redis[("Session and chunks<br/>[redis.py]")]
  node_config["Runtime settings<br/>[config.py]"]
  node_postgres[("Relational database<br/>[database.py]")]
end

node_candidate(("Candidate"))
node_openai_stt{{"OpenAI STT"}}
node_question_service{{"OpenRouter service"}}
node_browser{{"Browser media APIs"}}

node_candidate -->|"uses"| node_interview_ui
node_interview_ui -.->|"manages session"| node_session_context
node_camera -->|"starts stream"| node_camera_hook
node_camera_hook -->|"requests camera"| node_browser
node_mediapipe -->|"analyzes frames"| node_behavior
node_behavior -->|"delegates gaze"| node_gaze
node_behavior -->|"delegates gestures"| node_gesture
node_behavior -->|"delegates posture"| node_posture
node_behavior -->|"creates events"| node_events
node_behavior -->|"uses metrics"| node_math
node_mediapipe -.->|"uploads vision chunks"| node_session_api
node_interview_ui -.->|"requests session workflow"| node_session_api
node_session_api -->|"validates chunks"| node_chunk_schema
node_session_api -->|"uses session models"| node_session_schema
node_session_api -->|"reads and writes state"| node_redis
node_session_api -->|"transcribes answer audio"| node_transcriber
node_transcriber -.->|"sends audio"| node_openai_stt
node_session_api -->|"retrieves context"| node_rag
node_rag -->|"loads documents"| node_rag_loader
node_session_api -->|"generates next question"| node_question_gen
node_question_gen -->|"requests completion"| node_question_service
node_session_api -.->|"serves final report"| node_report
node_config -->|"configures connection"| node_redis
node_config -->|"configures model"| node_transcriber
node_config -->|"configures generation"| node_question_gen
node_postgres -->|"reads database settings"| node_config

click node_interview_ui "https://github.com/thdwlndjs/interviewiq/blob/main/frontend/app/page.tsx"
click node_session_context "https://github.com/thdwlndjs/interviewiq/blob/main/frontend/context/InterviewSessionContext.tsx"
click node_camera "https://github.com/thdwlndjs/interviewiq/blob/main/frontend/components/Camera/Camera.tsx"
click node_camera_hook "https://github.com/thdwlndjs/interviewiq/blob/main/frontend/hooks/useCamera.ts"
click node_mediapipe "https://github.com/thdwlndjs/interviewiq/blob/main/frontend/hooks/useMediaPipe.ts"
click node_behavior "https://github.com/thdwlndjs/interviewiq/blob/main/frontend/lib/analysis/interviewBehaviorAnalyzer.ts"
click node_gaze "https://github.com/thdwlndjs/interviewiq/blob/main/frontend/lib/analysis/gazeAnalyzer.ts"
click node_gesture "https://github.com/thdwlndjs/interviewiq/blob/main/frontend/lib/analysis/gestureAnalyzer.ts"
click node_posture "https://github.com/thdwlndjs/interviewiq/blob/main/frontend/lib/analysis/postureAnalyzer.ts"
click node_events "https://github.com/thdwlndjs/interviewiq/blob/main/frontend/lib/analysis/events.ts"
click node_math "https://github.com/thdwlndjs/interviewiq/blob/main/frontend/lib/analysis/math.ts"
click node_session_api "https://github.com/thdwlndjs/interviewiq/blob/main/app/api/sessions.py"
click node_chunk_schema "https://github.com/thdwlndjs/interviewiq/blob/main/app/schemas/chunk.py"
click node_session_schema "https://github.com/thdwlndjs/interviewiq/blob/main/app/schemas/session.py"
click node_transcriber "https://github.com/thdwlndjs/interviewiq/blob/main/app/llm/transcriber.py"
click node_rag "https://github.com/thdwlndjs/interviewiq/blob/main/app/rag/retriever.py"
click node_rag_loader "https://github.com/thdwlndjs/interviewiq/blob/main/app/rag/loader.py"
click node_question_gen "https://github.com/thdwlndjs/interviewiq/blob/main/app/llm/question_generator.py"
click node_report "https://github.com/thdwlndjs/interviewiq/blob/main/frontend/app/summary/page.tsx"
click node_redis "https://github.com/thdwlndjs/interviewiq/blob/main/app/core/redis.py"
click node_config "https://github.com/thdwlndjs/interviewiq/blob/main/app/core/config.py"
click node_postgres "https://github.com/thdwlndjs/interviewiq/blob/main/app/db/database.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_interview_ui,node_session_context,node_camera,node_camera_hook,node_browser toneBlue
class node_mediapipe,node_behavior,node_gaze,node_gesture,node_posture,node_events,node_math toneAmber
class node_session_api,node_chunk_schema,node_session_schema,node_report,node_question_service toneMint
class node_transcriber,node_rag,node_rag_loader,node_question_gen toneRose
class node_redis,node_config,node_postgres,node_candidate,node_openai_stt toneIndigo
```

## Components

### Interview client

- [Interview UI](https://github.com/thdwlndjs/interviewiq/blob/main/frontend/app/page.tsx): `frontend/app/page.tsx`
- [Session state](https://github.com/thdwlndjs/interviewiq/blob/main/frontend/context/InterviewSessionContext.tsx): `frontend/context/InterviewSessionContext.tsx`
- [Camera capture](https://github.com/thdwlndjs/interviewiq/blob/main/frontend/components/Camera/Camera.tsx): `frontend/components/Camera/Camera.tsx`
- [Camera stream](https://github.com/thdwlndjs/interviewiq/blob/main/frontend/hooks/useCamera.ts): `frontend/hooks/useCamera.ts`

### Vision analysis

- [Landmark detection](https://github.com/thdwlndjs/interviewiq/blob/main/frontend/hooks/useMediaPipe.ts): `frontend/hooks/useMediaPipe.ts`
- [Behavior analysis](https://github.com/thdwlndjs/interviewiq/blob/main/frontend/lib/analysis/interviewBehaviorAnalyzer.ts): `frontend/lib/analysis/interviewBehaviorAnalyzer.ts`
- [Gaze analysis](https://github.com/thdwlndjs/interviewiq/blob/main/frontend/lib/analysis/gazeAnalyzer.ts): `frontend/lib/analysis/gazeAnalyzer.ts`
- [Gesture analysis](https://github.com/thdwlndjs/interviewiq/blob/main/frontend/lib/analysis/gestureAnalyzer.ts): `frontend/lib/analysis/gestureAnalyzer.ts`
- [Posture analysis](https://github.com/thdwlndjs/interviewiq/blob/main/frontend/lib/analysis/postureAnalyzer.ts): `frontend/lib/analysis/postureAnalyzer.ts`
- [Behavior events](https://github.com/thdwlndjs/interviewiq/blob/main/frontend/lib/analysis/events.ts): `frontend/lib/analysis/events.ts`
- [Signal math](https://github.com/thdwlndjs/interviewiq/blob/main/frontend/lib/analysis/math.ts): `frontend/lib/analysis/math.ts`

### Session backend

- [Session API](https://github.com/thdwlndjs/interviewiq/blob/main/app/api/sessions.py): `app/api/sessions.py`
- [Chunk schema](https://github.com/thdwlndjs/interviewiq/blob/main/app/schemas/chunk.py): `app/schemas/chunk.py`
- [Session schema](https://github.com/thdwlndjs/interviewiq/blob/main/app/schemas/session.py): `app/schemas/session.py`
- [Summary report](https://github.com/thdwlndjs/interviewiq/blob/main/frontend/app/summary/page.tsx): `frontend/app/summary/page.tsx`

### Interview intelligence

- [Audio transcription](https://github.com/thdwlndjs/interviewiq/blob/main/app/llm/transcriber.py): `app/llm/transcriber.py`
- [RAG retrieval](https://github.com/thdwlndjs/interviewiq/blob/main/app/rag/retriever.py): `app/rag/retriever.py`
- [RAG documents](https://github.com/thdwlndjs/interviewiq/blob/main/app/rag/loader.py): `app/rag/loader.py`
- [Question generation](https://github.com/thdwlndjs/interviewiq/blob/main/app/llm/question_generator.py): `app/llm/question_generator.py`

### Persistence

- [Session and chunks](https://github.com/thdwlndjs/interviewiq/blob/main/app/core/redis.py): `app/core/redis.py`
- [Runtime settings](https://github.com/thdwlndjs/interviewiq/blob/main/app/core/config.py): `app/core/config.py`
- [Relational database](https://github.com/thdwlndjs/interviewiq/blob/main/app/db/database.py): `app/db/database.py`

### Other components

- **Candidate**
- **OpenAI STT**
- **OpenRouter service**
- **Browser media APIs**

## Connections

- Candidate → Interview UI: uses (evidence: `README.md`)
- Interview UI → Session state: manages session
- Camera capture → Camera stream: starts stream (evidence: `frontend/components/Camera/Camera.tsx`)
- Camera stream → Browser media APIs: requests camera (evidence: `frontend/hooks/useCamera.ts`)
- Landmark detection → Behavior analysis: analyzes frames (evidence: `frontend/hooks/useMediaPipe.ts`)
- Behavior analysis → Gaze analysis: delegates gaze (evidence: `frontend/lib/analysis/interviewBehaviorAnalyzer.ts`)
- Behavior analysis → Gesture analysis: delegates gestures (evidence: `frontend/lib/analysis/interviewBehaviorAnalyzer.ts`)
- Behavior analysis → Posture analysis: delegates posture (evidence: `frontend/lib/analysis/interviewBehaviorAnalyzer.ts`)
- Behavior analysis → Behavior events: creates events (evidence: `frontend/lib/analysis/interviewBehaviorAnalyzer.ts`)
- Behavior analysis → Signal math: uses metrics (evidence: `frontend/lib/analysis/interviewBehaviorAnalyzer.ts`)
- Landmark detection → Session API: uploads vision chunks (evidence: `README.md`)
- Interview UI → Session API: requests session workflow (evidence: `README.md`)
- Session API → Chunk schema: validates chunks (evidence: `app/api/sessions.py`)
- Session API → Session schema: uses session models (evidence: `app/api/sessions.py`)
- Session API → Session and chunks: reads and writes state (evidence: `app/api/sessions.py`)
- Session API → Audio transcription: transcribes answer audio (evidence: `README.md`)
- Audio transcription → OpenAI STT: sends audio (evidence: `README.md`)
- Session API → RAG retrieval: retrieves context (evidence: `app/api/sessions.py`)
- RAG retrieval → RAG documents: loads documents (evidence: `app/rag/retriever.py`)
- Session API → Question generation: generates next question (evidence: `app/api/sessions.py`)
- Question generation → OpenRouter service: requests completion (evidence: `app/llm/question_generator.py`)
- Session API → Summary report: serves final report (evidence: `README.md`)
- Runtime settings → Session and chunks: configures connection (evidence: `app/core/redis.py`)
- Runtime settings → Audio transcription: configures model (evidence: `app/llm/transcriber.py`)
- Runtime settings → Question generation: configures generation (evidence: `app/llm/question_generator.py`)
- Relational database → Runtime settings: reads database settings (evidence: `app/db/database.py`)
