# kakaotechcampus-4/ktc4-pusan-2 architecture

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

- Interactive diagram: https://gitdiagram.com/kakaotechcampus-4/ktc4-pusan-2
- Repository: https://github.com/kakaotechcampus-4/ktc4-pusan-2

## Overview

This repository is a pitch-coaching application: users prepare pitches and presentations, rehearse with camera and microphone input, and receive live coaching and speech transcription. The runtime map connects the browser rehearsal experience to backend authentication, pitch/take APIs, and realtime transcription; separate AI modules provide gaze analysis and coaching decisions. The README only describes team conventions, and several frontend, take-service, and AI-server links are inferred from the tree rather than verified in source, so those links are dashed.

Main entry points: [`frontend/src/shared/api/client.ts`](https://github.com/kakaotechcampus-4/ktc4-pusan-2/blob/develop/frontend/src/shared/api/client.ts) (API client), [`backend/src/pitch_coach_backend/module/auth/controller.py`](https://github.com/kakaotechcampus-4/ktc4-pusan-2/blob/develop/backend/src/pitch_coach_backend/module/auth/controller.py) (Authentication), [`backend/src/pitch_coach_backend/core/database.py`](https://github.com/kakaotechcampus-4/ktc4-pusan-2/blob/develop/backend/src/pitch_coach_backend/core/database.py) (Application database), [`frontend/src/app/routes.tsx`](https://github.com/kakaotechcampus-4/ktc4-pusan-2/blob/develop/frontend/src/app/routes.tsx) (App routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Browser app"]
  node_frontend["App routes<br/>[routes.tsx]"]
  node_session["Session state<br/>[useSession.ts]"]
  node_gazeclient["Gaze worker hook<br/>[useGazeWorker.ts]"]
  node_gazesetup["Gaze setup<br/>[useGazeSetup.ts]"]
  node_livegaze["Live gaze hook<br/>[useLiveGaze.ts]"]
  node_coachhook["Live coach hook<br/>[useCoach.ts]"]
  node_stthook["STT stream hook<br/>[useSttStream.ts]"]
  node_api_client["API client<br/>[client.ts]"]
end

subgraph group_api["Backend API"]
  node_auth["Authentication<br/>[controller.py]"]
  node_pitch["Pitch and scripts<br/>[controller.py]"]
  node_take["Take management<br/>[controller.py]"]
  node_realtime["Realtime session<br/>[controller.py]"]
  node_database[("Application database<br/>[database.py]")]
end

subgraph group_rehearsal["Rehearsal intelligence"]
  node_coach["Coach decision engine<br/>[engine.py]"]
  node_vision["Vision preprocessing<br/>[pipeline.py]"]
  node_gazeengine["Browser gaze engine<br/>[engine.ts]"]
end

subgraph group_providers["External services"]
  node_google["Google OAuth"]
  node_deepgram["Deepgram STT"]
  node_ai_service["AI parsing service"]
end

node_user(("Presenter"))

node_user -.->|"uses"| node_frontend
node_frontend -.->|"manages session"| node_session
node_frontend -.->|"requests API"| node_api_client
node_api_client -.->|"auth requests"| node_auth
node_api_client -.->|"pitch requests"| node_pitch
node_api_client -.->|"take requests"| node_take
node_session -.->|"refreshes session"| node_auth
node_auth -->|"redirects for login"| node_google
node_auth -.->|"uses session"| node_database
node_pitch -->|"uses session"| node_database
node_pitch -->|"schedules parsing"| node_ai_service
node_take -->|"uses session"| node_database
node_user -.->|"prepares camera"| node_gazesetup
node_gazesetup -.->|"starts gaze worker"| node_gazeclient
node_gazeclient -.->|"analyses frames"| node_gazeengine
node_livegaze -.->|"supplies gaze"| node_coachhook
node_coachhook -.->|"requests decisions"| node_coach
node_user -.->|"speaks rehearsal"| node_stthook
node_stthook -.->|"streams audio"| node_realtime
node_realtime -.->|"transcribes audio"| node_deepgram
node_realtime -->|"uses session"| node_database
node_vision -.->|"parallel implementation"| node_gazeengine

click node_frontend "https://github.com/kakaotechcampus-4/ktc4-pusan-2/blob/develop/frontend/src/app/routes.tsx"
click node_session "https://github.com/kakaotechcampus-4/ktc4-pusan-2/blob/develop/frontend/src/features/auth/useSession.ts"
click node_gazeclient "https://github.com/kakaotechcampus-4/ktc4-pusan-2/blob/develop/frontend/src/features/rehearsal/media/useGazeWorker.ts"
click node_gazesetup "https://github.com/kakaotechcampus-4/ktc4-pusan-2/blob/develop/frontend/src/features/rehearsal/prepare/useGazeSetup.ts"
click node_livegaze "https://github.com/kakaotechcampus-4/ktc4-pusan-2/blob/develop/frontend/src/features/rehearsal/stage/useLiveGaze.ts"
click node_coachhook "https://github.com/kakaotechcampus-4/ktc4-pusan-2/blob/develop/frontend/src/features/rehearsal/stage/useCoach.ts"
click node_stthook "https://github.com/kakaotechcampus-4/ktc4-pusan-2/blob/develop/frontend/src/features/rehearsal/stage/useSttStream.ts"
click node_api_client "https://github.com/kakaotechcampus-4/ktc4-pusan-2/blob/develop/frontend/src/shared/api/client.ts"
click node_auth "https://github.com/kakaotechcampus-4/ktc4-pusan-2/blob/develop/backend/src/pitch_coach_backend/module/auth/controller.py"
click node_pitch "https://github.com/kakaotechcampus-4/ktc4-pusan-2/blob/develop/backend/src/pitch_coach_backend/module/pitch/controller.py"
click node_take "https://github.com/kakaotechcampus-4/ktc4-pusan-2/blob/develop/backend/src/pitch_coach_backend/module/take/controller.py"
click node_realtime "https://github.com/kakaotechcampus-4/ktc4-pusan-2/blob/develop/backend/src/pitch_coach_backend/realtime/controller.py"
click node_database "https://github.com/kakaotechcampus-4/ktc4-pusan-2/blob/develop/backend/src/pitch_coach_backend/core/database.py"
click node_coach "https://github.com/kakaotechcampus-4/ktc4-pusan-2/blob/develop/ai/archive/workspaces/jewon-kim/coach-agent/v1/local/ai/src/coach/engine.py"
click node_vision "https://github.com/kakaotechcampus-4/ktc4-pusan-2/blob/develop/ai/research/gaze-tracking/src/gaze_lab/preprocess/pipeline.py"
click node_gazeengine "https://github.com/kakaotechcampus-4/ktc4-pusan-2/blob/develop/ai/research/gaze-tracking/web/src/engine/engine.ts"

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_frontend,node_session,node_gazeclient,node_gazesetup,node_livegaze,node_coachhook,node_stthook,node_api_client toneBlue
class node_auth,node_pitch,node_take,node_realtime,node_database toneAmber
class node_coach,node_vision,node_gazeengine toneMint
class node_google,node_deepgram,node_ai_service toneRose
class node_user toneIndigo
```

## Components

### Browser app

- [App routes](https://github.com/kakaotechcampus-4/ktc4-pusan-2/blob/develop/frontend/src/app/routes.tsx): `frontend/src/app/routes.tsx`
- [Session state](https://github.com/kakaotechcampus-4/ktc4-pusan-2/blob/develop/frontend/src/features/auth/useSession.ts): `frontend/src/features/auth/useSession.ts`
- [Gaze worker hook](https://github.com/kakaotechcampus-4/ktc4-pusan-2/blob/develop/frontend/src/features/rehearsal/media/useGazeWorker.ts): `frontend/src/features/rehearsal/media/useGazeWorker.ts`
- [Gaze setup](https://github.com/kakaotechcampus-4/ktc4-pusan-2/blob/develop/frontend/src/features/rehearsal/prepare/useGazeSetup.ts): `frontend/src/features/rehearsal/prepare/useGazeSetup.ts`
- [Live gaze hook](https://github.com/kakaotechcampus-4/ktc4-pusan-2/blob/develop/frontend/src/features/rehearsal/stage/useLiveGaze.ts): `frontend/src/features/rehearsal/stage/useLiveGaze.ts`
- [Live coach hook](https://github.com/kakaotechcampus-4/ktc4-pusan-2/blob/develop/frontend/src/features/rehearsal/stage/useCoach.ts): `frontend/src/features/rehearsal/stage/useCoach.ts`
- [STT stream hook](https://github.com/kakaotechcampus-4/ktc4-pusan-2/blob/develop/frontend/src/features/rehearsal/stage/useSttStream.ts): `frontend/src/features/rehearsal/stage/useSttStream.ts`
- [API client](https://github.com/kakaotechcampus-4/ktc4-pusan-2/blob/develop/frontend/src/shared/api/client.ts): `frontend/src/shared/api/client.ts`

### Backend API

- [Authentication](https://github.com/kakaotechcampus-4/ktc4-pusan-2/blob/develop/backend/src/pitch_coach_backend/module/auth/controller.py): `backend/src/pitch_coach_backend/module/auth/controller.py`
- [Pitch and scripts](https://github.com/kakaotechcampus-4/ktc4-pusan-2/blob/develop/backend/src/pitch_coach_backend/module/pitch/controller.py): `backend/src/pitch_coach_backend/module/pitch/controller.py`
- [Take management](https://github.com/kakaotechcampus-4/ktc4-pusan-2/blob/develop/backend/src/pitch_coach_backend/module/take/controller.py): `backend/src/pitch_coach_backend/module/take/controller.py`
- [Realtime session](https://github.com/kakaotechcampus-4/ktc4-pusan-2/blob/develop/backend/src/pitch_coach_backend/realtime/controller.py): `backend/src/pitch_coach_backend/realtime/controller.py`
- [Application database](https://github.com/kakaotechcampus-4/ktc4-pusan-2/blob/develop/backend/src/pitch_coach_backend/core/database.py): `backend/src/pitch_coach_backend/core/database.py`

### Rehearsal intelligence

- [Coach decision engine](https://github.com/kakaotechcampus-4/ktc4-pusan-2/blob/develop/ai/archive/workspaces/jewon-kim/coach-agent/v1/local/ai/src/coach/engine.py): `ai/archive/workspaces/jewon-kim/coach-agent/v1/local/ai/src/coach/engine.py`
- [Vision preprocessing](https://github.com/kakaotechcampus-4/ktc4-pusan-2/blob/develop/ai/research/gaze-tracking/src/gaze_lab/preprocess/pipeline.py): `ai/research/gaze-tracking/src/gaze_lab/preprocess/pipeline.py`
- [Browser gaze engine](https://github.com/kakaotechcampus-4/ktc4-pusan-2/blob/develop/ai/research/gaze-tracking/web/src/engine/engine.ts): `ai/research/gaze-tracking/web/src/engine/engine.ts`

### External services

- **Google OAuth**
- **Deepgram STT**
- **AI parsing service**

### Other components

- **Presenter**

## Connections

- Presenter → App routes: uses
- App routes → Session state: manages session
- App routes → API client: requests API
- API client → Authentication: auth requests
- API client → Pitch and scripts: pitch requests
- API client → Take management: take requests
- Session state → Authentication: refreshes session
- Authentication → Google OAuth: redirects for login (evidence: `backend/src/pitch_coach_backend/module/auth/controller.py`)
- Authentication → Application database: uses session (evidence: `backend/src/pitch_coach_backend/module/auth/controller.py`)
- Pitch and scripts → Application database: uses session (evidence: `backend/src/pitch_coach_backend/module/pitch/controller.py`)
- Pitch and scripts → AI parsing service: schedules parsing (evidence: `backend/src/pitch_coach_backend/module/pitch/controller.py`)
- Take management → Application database: uses session (evidence: `backend/src/pitch_coach_backend/module/take/controller.py`)
- Presenter → Gaze setup: prepares camera
- Gaze setup → Gaze worker hook: starts gaze worker
- Gaze worker hook → Browser gaze engine: analyses frames
- Live gaze hook → Live coach hook: supplies gaze
- Live coach hook → Coach decision engine: requests decisions
- Presenter → STT stream hook: speaks rehearsal
- STT stream hook → Realtime session: streams audio
- Realtime session → Deepgram STT: transcribes audio
- Realtime session → Application database: uses session (evidence: `backend/src/pitch_coach_backend/realtime/controller.py`)
- Vision preprocessing → Browser gaze engine: parallel implementation
