# akanemo22/coc-working architecture

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

- Interactive diagram: https://gitdiagram.com/akanemo22/coc-working
- Repository: https://github.com/akanemo22/coc-working

## Overview

Cóc Đi Làm is a browser-based Vietnamese mock-interview product: a candidate selects a CV and specific job/framework, completes a microphone-driven interview, then receives a rubric report after the session ends. The browser handles speech detection and audio interaction; a single FastAPI backend coordinates candidate context, interview decisions, question generation, speech recognition and synthesis, and evaluation. Redis holds hot session state, with database infrastructure also present. The README documents several runtime links, while sampled source is incomplete; unsupported implementation-level connections are omitted.

Main entry points: [`backend/app/domains/interview/api/sessions.py`](https://github.com/akanemo22/coc-working/blob/main/backend/app/domains/interview/api/sessions.py) (Session and report API), [`backend/app/domains/interview/websocket.py`](https://github.com/akanemo22/coc-working/blob/main/backend/app/domains/interview/websocket.py) (Interview turn manager), [`backend/app/main.py`](https://github.com/akanemo22/coc-working/blob/main/backend/app/main.py) (FastAPI application), [`backend/app/domains/candidate/api.py`](https://github.com/akanemo22/coc-working/blob/main/backend/app/domains/candidate/api.py) (Candidate API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Browser experience"]
  node_setup_ui["CV and JD selection<br/>[page.tsx]"]
  node_live_ui["Live interview UI<br/>[page.tsx]"]
  node_audio_capture["Audio capture"]
  node_vad["Browser voice detection<br/>[vad.worker.ts]"]
  node_socket_hook["Interview socket client"]
  node_report_ui["Interview report<br/>[page.tsx]"]
end

subgraph group_candidate["Candidate and framework"]
  node_candidate_api["Candidate API<br/>[api.py]"]
  node_cv_analysis["CV analysis<br/>[cv_analyzer.py]"]
  node_candidate_context["Candidate context<br/>[context.py]"]
  node_candidate_facade["Candidate data facade<br/>[facade.py]"]
  node_candidate_catalog["Candidate catalog<br/>[catalog.py]"]
end

subgraph group_interview["Interview runtime"]
  node_framework_catalog["Interview frameworks<br/>[catalog.py]"]
  node_session_api["Session and report API<br/>[sessions.py]"]
  node_questions_api["Question API<br/>[questions.py]"]
  node_websocket["Interview turn manager<br/>[websocket.py]"]
  node_policy["Hard policy engine"]
  node_laya["Laya decision controller<br/>[laya_controller.py]"]
  node_question_service["Question generation<br/>[questions.py]"]
  node_dialogue["Dialogue orchestration<br/>[dialogue.py]"]
  node_guidance["Interview guidance<br/>[guidance.py]"]
  node_reverse_interview["Reverse interview"]
  node_evaluator["Rubric evaluator"]
  node_report_service["Report service<br/>[report_service.py]"]
end

subgraph group_speech["Speech services"]
  node_speech_api["Speech API<br/>[api.py]"]
  node_qwen{{"Qwen speech recognition"}}
  node_vieneu{{"VieNeu speech synthesis"}}
end

subgraph group_shared["State and infrastructure"]
  node_redis[("Session state store<br/>[redis.py]")]
  node_database[("Supabase database<br/>[database.py]")]
  node_normalized[("Normalized data store<br/>[normalized_data.py]")]
  node_contracts["Domain contracts<br/>[contracts.py]"]
  node_config["Backend settings<br/>[config.py]"]
  node_main["FastAPI application<br/>[main.py]"]
end

node_candidate(("Candidate"))
node_gemini{{"Gemini API"}}

node_candidate -->|"selects CV and JD"| node_setup_ui
node_setup_ui -.->|"requests candidate data"| node_candidate_api
node_setup_ui -->|"creates session"| node_session_api
node_candidate_api -->|"analyzes CV"| node_cv_analysis
node_candidate_api -->|"loads context"| node_candidate_context
node_candidate_api -->|"uses catalog"| node_candidate_catalog
node_candidate_api -->|"requests interview data"| node_candidate_facade
node_session_api -->|"loads session context"| node_candidate_facade
node_session_api -->|"resolves framework"| node_framework_catalog
node_candidate_facade -->|"reads candidate data"| node_candidate_catalog
node_candidate_facade -->|"builds context"| node_candidate_context
node_framework_catalog -->|"reads records"| node_normalized
node_session_api -->|"stores session state"| node_redis
node_live_ui -->|"captures microphone"| node_audio_capture
node_audio_capture -.->|"sends audio chunks"| node_vad
node_live_ui -.->|"uses socket client"| node_socket_hook
node_socket_hook -->|"streams interview turns"| node_websocket
node_websocket -.->|"requests speech recognition"| node_speech_api
node_speech_api -->|"transcribes audio"| node_qwen
node_websocket -->|"validates actions"| node_policy
node_websocket -->|"requests decisions"| node_laya
node_websocket -->|"requests questions"| node_question_service
node_question_service -->|"delegates dialogue"| node_dialogue
node_question_service -->|"uses framework"| node_framework_catalog
node_dialogue -->|"uses guidance"| node_guidance
node_dialogue -->|"uses interview catalog"| node_framework_catalog
node_dialogue -->|"generates interview text"| node_gemini
node_websocket -->|"routes reverse interview"| node_reverse_interview
node_live_ui -->|"requests speech synthesis"| node_speech_api
node_speech_api -->|"synthesizes speech"| node_vieneu
node_session_api -->|"evaluates completed session"| node_evaluator
node_evaluator -->|"scores rubric"| node_gemini
node_session_api -->|"builds report"| node_report_service
node_report_service -->|"reads report state"| node_redis
node_report_ui -.->|"retrieves report"| node_session_api
node_main -->|"mounts router"| node_candidate_api
node_main -->|"mounts router"| node_session_api
node_main -->|"mounts router"| node_questions_api
node_main -->|"mounts WebSocket"| node_websocket
node_main -->|"mounts router"| node_speech_api
node_main -->|"loads settings"| node_config
node_websocket -->|"persists turn state"| node_redis
node_session_api -->|"uses request schemas"| node_contracts
node_main -->|"initializes database"| node_database

click node_setup_ui "https://github.com/akanemo22/coc-working/blob/main/frontend/src/app/interview/page.tsx"
click node_live_ui "https://github.com/akanemo22/coc-working/blob/main/frontend/src/app/interview/%5BsessionId%5D/page.tsx"
click node_audio_capture "https://github.com/akanemo22/coc-working/blob/main/frontend/src/hooks/useAudioRecorder.ts"
click node_vad "https://github.com/akanemo22/coc-working/blob/main/frontend/src/workers/vad.worker.ts"
click node_socket_hook "https://github.com/akanemo22/coc-working/blob/main/frontend/src/hooks/useInterviewSocket.ts"
click node_report_ui "https://github.com/akanemo22/coc-working/blob/main/frontend/src/app/report/%5BsessionId%5D/page.tsx"
click node_candidate_api "https://github.com/akanemo22/coc-working/blob/main/backend/app/domains/candidate/api.py"
click node_cv_analysis "https://github.com/akanemo22/coc-working/blob/main/backend/app/domains/candidate/services/cv_analyzer.py"
click node_candidate_context "https://github.com/akanemo22/coc-working/blob/main/backend/app/domains/candidate/context.py"
click node_candidate_facade "https://github.com/akanemo22/coc-working/blob/main/backend/app/domains/candidate/facade.py"
click node_candidate_catalog "https://github.com/akanemo22/coc-working/blob/main/backend/app/domains/candidate/catalog.py"
click node_framework_catalog "https://github.com/akanemo22/coc-working/blob/main/backend/app/domains/interview/catalog.py"
click node_session_api "https://github.com/akanemo22/coc-working/blob/main/backend/app/domains/interview/api/sessions.py"
click node_questions_api "https://github.com/akanemo22/coc-working/blob/main/backend/app/domains/interview/api/questions.py"
click node_websocket "https://github.com/akanemo22/coc-working/blob/main/backend/app/domains/interview/websocket.py"
click node_policy "https://github.com/akanemo22/coc-working/blob/main/backend/app/domains/interview/services/hard_policy_engine.py"
click node_laya "https://github.com/akanemo22/coc-working/blob/main/backend/app/domains/interview/services/laya_controller.py"
click node_question_service "https://github.com/akanemo22/coc-working/blob/main/backend/app/domains/interview/services/questions.py"
click node_dialogue "https://github.com/akanemo22/coc-working/blob/main/backend/app/domains/interview/services/dialogue.py"
click node_guidance "https://github.com/akanemo22/coc-working/blob/main/backend/app/domains/interview/services/guidance.py"
click node_reverse_interview "https://github.com/akanemo22/coc-working/blob/main/backend/app/domains/interview/services/reverse_interview_service.py"
click node_evaluator "https://github.com/akanemo22/coc-working/blob/main/backend/app/domains/interview/services/evidence_evaluator.py"
click node_report_service "https://github.com/akanemo22/coc-working/blob/main/backend/app/domains/interview/services/report_service.py"
click node_speech_api "https://github.com/akanemo22/coc-working/blob/main/backend/app/domains/speech/api.py"
click node_redis "https://github.com/akanemo22/coc-working/blob/main/backend/app/shared/infrastructure/redis.py"
click node_database "https://github.com/akanemo22/coc-working/blob/main/backend/app/shared/infrastructure/database.py"
click node_normalized "https://github.com/akanemo22/coc-working/blob/main/backend/app/shared/infrastructure/normalized_data.py"
click node_contracts "https://github.com/akanemo22/coc-working/blob/main/backend/app/shared/contracts.py"
click node_config "https://github.com/akanemo22/coc-working/blob/main/backend/app/shared/config.py"
click node_main "https://github.com/akanemo22/coc-working/blob/main/backend/app/main.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_setup_ui,node_live_ui,node_audio_capture,node_vad,node_socket_hook,node_report_ui toneBlue
class node_candidate_api,node_cv_analysis,node_candidate_context,node_candidate_facade,node_candidate_catalog toneAmber
class node_framework_catalog,node_session_api,node_questions_api,node_websocket,node_policy,node_laya,node_question_service,node_dialogue,node_guidance,node_reverse_interview,node_evaluator,node_report_service,node_gemini toneMint
class node_speech_api,node_qwen,node_vieneu toneRose
class node_redis,node_database,node_normalized,node_contracts,node_config,node_main,node_candidate toneIndigo
```

## Components

### Browser experience

- [CV and JD selection](https://github.com/akanemo22/coc-working/blob/main/frontend/src/app/interview/page.tsx): `frontend/src/app/interview/page.tsx`
- [Live interview UI](https://github.com/akanemo22/coc-working/blob/main/frontend/src/app/interview/%5BsessionId%5D/page.tsx): `frontend/src/app/interview/[sessionId]/page.tsx`
- [Audio capture](https://github.com/akanemo22/coc-working/blob/main/frontend/src/hooks/useAudioRecorder.ts): `frontend/src/hooks/useAudioRecorder.ts`
- [Browser voice detection](https://github.com/akanemo22/coc-working/blob/main/frontend/src/workers/vad.worker.ts): `frontend/src/workers/vad.worker.ts`
- [Interview socket client](https://github.com/akanemo22/coc-working/blob/main/frontend/src/hooks/useInterviewSocket.ts): `frontend/src/hooks/useInterviewSocket.ts`
- [Interview report](https://github.com/akanemo22/coc-working/blob/main/frontend/src/app/report/%5BsessionId%5D/page.tsx): `frontend/src/app/report/[sessionId]/page.tsx`

### Candidate and framework

- [Candidate API](https://github.com/akanemo22/coc-working/blob/main/backend/app/domains/candidate/api.py): `backend/app/domains/candidate/api.py`
- [CV analysis](https://github.com/akanemo22/coc-working/blob/main/backend/app/domains/candidate/services/cv_analyzer.py): `backend/app/domains/candidate/services/cv_analyzer.py`
- [Candidate context](https://github.com/akanemo22/coc-working/blob/main/backend/app/domains/candidate/context.py): `backend/app/domains/candidate/context.py`
- [Candidate data facade](https://github.com/akanemo22/coc-working/blob/main/backend/app/domains/candidate/facade.py): `backend/app/domains/candidate/facade.py`
- [Candidate catalog](https://github.com/akanemo22/coc-working/blob/main/backend/app/domains/candidate/catalog.py): `backend/app/domains/candidate/catalog.py`

### Interview runtime

- [Interview frameworks](https://github.com/akanemo22/coc-working/blob/main/backend/app/domains/interview/catalog.py): `backend/app/domains/interview/catalog.py`
- [Session and report API](https://github.com/akanemo22/coc-working/blob/main/backend/app/domains/interview/api/sessions.py): `backend/app/domains/interview/api/sessions.py`
- [Question API](https://github.com/akanemo22/coc-working/blob/main/backend/app/domains/interview/api/questions.py): `backend/app/domains/interview/api/questions.py`
- [Interview turn manager](https://github.com/akanemo22/coc-working/blob/main/backend/app/domains/interview/websocket.py): `backend/app/domains/interview/websocket.py`
- [Hard policy engine](https://github.com/akanemo22/coc-working/blob/main/backend/app/domains/interview/services/hard_policy_engine.py): `backend/app/domains/interview/services/hard_policy_engine.py`
- [Laya decision controller](https://github.com/akanemo22/coc-working/blob/main/backend/app/domains/interview/services/laya_controller.py): `backend/app/domains/interview/services/laya_controller.py`
- [Question generation](https://github.com/akanemo22/coc-working/blob/main/backend/app/domains/interview/services/questions.py): `backend/app/domains/interview/services/questions.py`
- [Dialogue orchestration](https://github.com/akanemo22/coc-working/blob/main/backend/app/domains/interview/services/dialogue.py): `backend/app/domains/interview/services/dialogue.py`
- [Interview guidance](https://github.com/akanemo22/coc-working/blob/main/backend/app/domains/interview/services/guidance.py): `backend/app/domains/interview/services/guidance.py`
- [Reverse interview](https://github.com/akanemo22/coc-working/blob/main/backend/app/domains/interview/services/reverse_interview_service.py): `backend/app/domains/interview/services/reverse_interview_service.py`
- [Rubric evaluator](https://github.com/akanemo22/coc-working/blob/main/backend/app/domains/interview/services/evidence_evaluator.py): `backend/app/domains/interview/services/evidence_evaluator.py`
- [Report service](https://github.com/akanemo22/coc-working/blob/main/backend/app/domains/interview/services/report_service.py): `backend/app/domains/interview/services/report_service.py`

### Speech services

- [Speech API](https://github.com/akanemo22/coc-working/blob/main/backend/app/domains/speech/api.py): `backend/app/domains/speech/api.py`
- **Qwen speech recognition**
- **VieNeu speech synthesis**

### State and infrastructure

- [Session state store](https://github.com/akanemo22/coc-working/blob/main/backend/app/shared/infrastructure/redis.py): `backend/app/shared/infrastructure/redis.py`
- [Supabase database](https://github.com/akanemo22/coc-working/blob/main/backend/app/shared/infrastructure/database.py): `backend/app/shared/infrastructure/database.py`
- [Normalized data store](https://github.com/akanemo22/coc-working/blob/main/backend/app/shared/infrastructure/normalized_data.py): `backend/app/shared/infrastructure/normalized_data.py`
- [Domain contracts](https://github.com/akanemo22/coc-working/blob/main/backend/app/shared/contracts.py): `backend/app/shared/contracts.py`
- [Backend settings](https://github.com/akanemo22/coc-working/blob/main/backend/app/shared/config.py): `backend/app/shared/config.py`
- [FastAPI application](https://github.com/akanemo22/coc-working/blob/main/backend/app/main.py): `backend/app/main.py`

### Other components

- **Candidate**
- **Gemini API**

## Connections

- Candidate → CV and JD selection: selects CV and JD (evidence: `README.md`)
- CV and JD selection → Candidate API: requests candidate data
- CV and JD selection → Session and report API: creates session (evidence: `README.md`)
- Candidate API → CV analysis: analyzes CV (evidence: `backend/app/domains/candidate/api.py`)
- Candidate API → Candidate context: loads context (evidence: `backend/app/domains/candidate/api.py`)
- Candidate API → Candidate catalog: uses catalog (evidence: `backend/app/domains/candidate/api.py`)
- Candidate API → Candidate data facade: requests interview data (evidence: `backend/app/domains/candidate/api.py`)
- Session and report API → Candidate data facade: loads session context (evidence: `backend/app/domains/interview/api/sessions.py`)
- Session and report API → Interview frameworks: resolves framework (evidence: `backend/app/domains/interview/api/sessions.py`)
- Candidate data facade → Candidate catalog: reads candidate data (evidence: `backend/app/domains/candidate/facade.py`)
- Candidate data facade → Candidate context: builds context (evidence: `backend/app/domains/candidate/facade.py`)
- Interview frameworks → Normalized data store: reads records (evidence: `backend/app/domains/interview/catalog.py`)
- Session and report API → Session state store: stores session state (evidence: `backend/app/domains/interview/api/sessions.py`)
- Live interview UI → Audio capture: captures microphone (evidence: `README.md`)
- Audio capture → Browser voice detection: sends audio chunks
- Live interview UI → Interview socket client: uses socket client
- Interview socket client → Interview turn manager: streams interview turns (evidence: `README.md`)
- Interview turn manager → Speech API: requests speech recognition
- Speech API → Qwen speech recognition: transcribes audio (evidence: `README.md`)
- Interview turn manager → Hard policy engine: validates actions (evidence: `backend/app/domains/interview/websocket.py`)
- Interview turn manager → Laya decision controller: requests decisions (evidence: `backend/app/domains/interview/websocket.py`)
- Interview turn manager → Question generation: requests questions (evidence: `backend/app/domains/interview/websocket.py`)
- Question generation → Dialogue orchestration: delegates dialogue (evidence: `backend/app/domains/interview/services/questions.py`)
- Question generation → Interview frameworks: uses framework (evidence: `backend/app/domains/interview/services/questions.py`)
- Dialogue orchestration → Interview guidance: uses guidance (evidence: `backend/app/domains/interview/services/dialogue.py`)
- Dialogue orchestration → Interview frameworks: uses interview catalog (evidence: `backend/app/domains/interview/services/dialogue.py`)
- Dialogue orchestration → Gemini API: generates interview text (evidence: `README.md`)
- Interview turn manager → Reverse interview: routes reverse interview (evidence: `backend/app/domains/interview/websocket.py`)
- Live interview UI → Speech API: requests speech synthesis (evidence: `README.md`)
- Speech API → VieNeu speech synthesis: synthesizes speech (evidence: `README.md`)
- Session and report API → Rubric evaluator: evaluates completed session (evidence: `backend/app/domains/interview/api/sessions.py`)
- Rubric evaluator → Gemini API: scores rubric (evidence: `README.md`)
- Session and report API → Report service: builds report (evidence: `backend/app/domains/interview/api/sessions.py`)
- Report service → Session state store: reads report state (evidence: `backend/app/domains/interview/services/report_service.py`)
- Interview report → Session and report API: retrieves report
- FastAPI application → Candidate API: mounts router (evidence: `backend/app/main.py`)
- FastAPI application → Session and report API: mounts router (evidence: `backend/app/main.py`)
- FastAPI application → Question API: mounts router (evidence: `backend/app/main.py`)
- FastAPI application → Interview turn manager: mounts WebSocket (evidence: `backend/app/main.py`)
- FastAPI application → Speech API: mounts router (evidence: `backend/app/main.py`)
- FastAPI application → Backend settings: loads settings (evidence: `backend/app/main.py`)
- Interview turn manager → Session state store: persists turn state (evidence: `backend/app/domains/interview/websocket.py`)
- Session and report API → Domain contracts: uses request schemas (evidence: `backend/app/domains/interview/api/sessions.py`)
- FastAPI application → Supabase database: initializes database (evidence: `backend/app/main.py`)
