# saidmansurhon/mock-cefr architecture

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

- Interactive diagram: https://gitdiagram.com/saidmansurhon/mock-cefr
- Repository: https://github.com/saidmansurhon/mock-cefr

## Overview

This is a CEFR speaking-test web app: a learner receives a multi-part test, prepares and records spoken answers, then sees an AI-generated level, explanation, and tip. The React app controls test and part progression; the Express API supplies test content, accepts audio, transcribes it, and evaluates the collected answers. MongoDB stores test definitions and GridFS images; Deepgram and OpenAI provide speech recognition and assessment. The source excerpts show these main flows; the frontend README is present but contains no architecture details, and other frontend modules were not sampled.

Main entry points: [`speaking-test/backend/index.js`](https://github.com/saidmansurhon/mock-cefr/blob/main/speaking-test/backend/index.js) (Test API), [`speaking-test/frontend/src/App.js`](https://github.com/saidmansurhon/mock-cefr/blob/main/speaking-test/frontend/src/App.js) (Session coordinator), [`speaking-test/frontend/src/SpeechTestLogic.js`](https://github.com/saidmansurhon/mock-cefr/blob/main/speaking-test/frontend/src/SpeechTestLogic.js) (Recording flow), [`speaking-test/backend/data_loader.js`](https://github.com/saidmansurhon/mock-cefr/blob/main/speaking-test/backend/data_loader.js) (Content loader)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Test experience"]
  node_app["Session coordinator<br/>[App.js]"]
  node_test_logic["Recording flow<br/>[SpeechTestLogic.js]"]
  node_test_ui["Test interface<br/>[SpeechTestUI.js]"]
end

subgraph group_backend["Test services"]
  node_test_api["Test API<br/>[index.js]"]
  node_session_state[("Session answers<br/>[index.js]")]
  node_image_delivery["Image delivery<br/>[index.js]"]
end

subgraph group_content["Test content"]
  node_question_store[("Test definitions<br/>[index.js]")]
  node_content_loader["Content loader<br/>[data_loader.js]"]
  node_question_file["Question data<br/>[questions.json]"]
  node_image_files["Image assets"]
end

subgraph group_assessment["Speech assessment"]
  node_final_assessment["Final evaluator<br/>[index.js]"]
  node_deepgram["Deepgram"]
  node_openai["OpenAI"]
end

node_learner(("Learner"))
node_microphone(("Microphone"))

node_learner -->|"uses"| node_app
node_app -->|"starts test"| node_test_api
node_test_api -->|"selects test"| node_question_store
node_test_api -->|"creates session"| node_session_state
node_app -->|"renders part"| node_test_logic
node_test_logic -->|"renders controls"| node_test_ui
node_learner -->|"answers prompts"| node_test_ui
node_test_ui -->|"starts recording"| node_test_logic
node_test_logic -->|"captures audio"| node_microphone
node_test_logic -->|"submits answer"| node_app
node_app -->|"uploads audio"| node_test_api
node_test_api -->|"transcribes audio"| node_deepgram
node_test_api -->|"stores transcript"| node_session_state
node_test_api -->|"requests assessment"| node_final_assessment
node_final_assessment -->|"reads answers"| node_session_state
node_final_assessment -->|"reads questions"| node_question_store
node_final_assessment -->|"requests rating"| node_openai
node_test_api -->|"returns result"| node_app
node_content_loader -->|"reads data"| node_question_file
node_content_loader -->|"reads assets"| node_image_files
node_content_loader -->|"loads definitions"| node_question_store
node_content_loader -->|"uploads images"| node_image_delivery
node_test_api -->|"serves images"| node_image_delivery
node_test_logic -->|"builds image URLs"| node_image_delivery
node_app -->|"fetches final"| node_test_api

click node_app "https://github.com/saidmansurhon/mock-cefr/blob/main/speaking-test/frontend/src/App.js"
click node_test_logic "https://github.com/saidmansurhon/mock-cefr/blob/main/speaking-test/frontend/src/SpeechTestLogic.js"
click node_test_ui "https://github.com/saidmansurhon/mock-cefr/blob/main/speaking-test/frontend/src/SpeechTestUI.js"
click node_test_api "https://github.com/saidmansurhon/mock-cefr/blob/main/speaking-test/backend/index.js"
click node_session_state "https://github.com/saidmansurhon/mock-cefr/blob/main/speaking-test/backend/index.js"
click node_final_assessment "https://github.com/saidmansurhon/mock-cefr/blob/main/speaking-test/backend/index.js"
click node_question_store "https://github.com/saidmansurhon/mock-cefr/blob/main/speaking-test/backend/index.js"
click node_content_loader "https://github.com/saidmansurhon/mock-cefr/blob/main/speaking-test/backend/data_loader.js"
click node_question_file "https://github.com/saidmansurhon/mock-cefr/blob/main/speaking-test/backend/questions.json"
click node_image_files "https://github.com/saidmansurhon/mock-cefr/tree/main/speaking-test/backend/images"
click node_image_delivery "https://github.com/saidmansurhon/mock-cefr/blob/main/speaking-test/backend/index.js"

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_app,node_test_logic,node_test_ui toneBlue
class node_test_api,node_session_state,node_image_delivery toneAmber
class node_question_store,node_content_loader,node_question_file,node_image_files toneMint
class node_final_assessment,node_deepgram,node_openai toneRose
class node_learner,node_microphone toneIndigo
```

## Components

### Test experience

- [Session coordinator](https://github.com/saidmansurhon/mock-cefr/blob/main/speaking-test/frontend/src/App.js): `speaking-test/frontend/src/App.js`
- [Recording flow](https://github.com/saidmansurhon/mock-cefr/blob/main/speaking-test/frontend/src/SpeechTestLogic.js): `speaking-test/frontend/src/SpeechTestLogic.js`
- [Test interface](https://github.com/saidmansurhon/mock-cefr/blob/main/speaking-test/frontend/src/SpeechTestUI.js): `speaking-test/frontend/src/SpeechTestUI.js`

### Test services

- [Test API](https://github.com/saidmansurhon/mock-cefr/blob/main/speaking-test/backend/index.js): `speaking-test/backend/index.js`
- [Session answers](https://github.com/saidmansurhon/mock-cefr/blob/main/speaking-test/backend/index.js): `speaking-test/backend/index.js`
- [Image delivery](https://github.com/saidmansurhon/mock-cefr/blob/main/speaking-test/backend/index.js): `speaking-test/backend/index.js`

### Test content

- [Test definitions](https://github.com/saidmansurhon/mock-cefr/blob/main/speaking-test/backend/index.js): `speaking-test/backend/index.js`
- [Content loader](https://github.com/saidmansurhon/mock-cefr/blob/main/speaking-test/backend/data_loader.js): `speaking-test/backend/data_loader.js`
- [Question data](https://github.com/saidmansurhon/mock-cefr/blob/main/speaking-test/backend/questions.json): `speaking-test/backend/questions.json`
- [Image assets](https://github.com/saidmansurhon/mock-cefr/tree/main/speaking-test/backend/images): `speaking-test/backend/images`

### Speech assessment

- [Final evaluator](https://github.com/saidmansurhon/mock-cefr/blob/main/speaking-test/backend/index.js): `speaking-test/backend/index.js`
- **Deepgram**
- **OpenAI**

### Other components

- **Learner**
- **Microphone**

## Connections

- Learner → Session coordinator: uses (evidence: `speaking-test/frontend/src/App.js`)
- Session coordinator → Test API: starts test (evidence: `speaking-test/frontend/src/App.js`)
- Test API → Test definitions: selects test (evidence: `speaking-test/backend/index.js`)
- Test API → Session answers: creates session (evidence: `speaking-test/backend/index.js`)
- Session coordinator → Recording flow: renders part (evidence: `speaking-test/frontend/src/App.js`)
- Recording flow → Test interface: renders controls (evidence: `speaking-test/frontend/src/SpeechTestLogic.js`)
- Learner → Test interface: answers prompts (evidence: `speaking-test/frontend/src/SpeechTestUI.js`)
- Test interface → Recording flow: starts recording (evidence: `speaking-test/frontend/src/SpeechTestUI.js`)
- Recording flow → Microphone: captures audio (evidence: `speaking-test/frontend/src/SpeechTestLogic.js`)
- Recording flow → Session coordinator: submits answer (evidence: `speaking-test/frontend/src/SpeechTestLogic.js`)
- Session coordinator → Test API: uploads audio (evidence: `speaking-test/frontend/src/App.js`)
- Test API → Deepgram: transcribes audio (evidence: `speaking-test/backend/index.js`)
- Test API → Session answers: stores transcript (evidence: `speaking-test/backend/index.js`)
- Test API → Final evaluator: requests assessment (evidence: `speaking-test/backend/index.js`)
- Final evaluator → Session answers: reads answers (evidence: `speaking-test/backend/index.js`)
- Final evaluator → Test definitions: reads questions (evidence: `speaking-test/backend/index.js`)
- Final evaluator → OpenAI: requests rating (evidence: `speaking-test/backend/index.js`)
- Test API → Session coordinator: returns result (evidence: `speaking-test/frontend/src/App.js`)
- Content loader → Question data: reads data (evidence: `speaking-test/backend/data_loader.js`)
- Content loader → Image assets: reads assets (evidence: `speaking-test/backend/data_loader.js`)
- Content loader → Test definitions: loads definitions (evidence: `speaking-test/backend/data_loader.js`)
- Content loader → Image delivery: uploads images (evidence: `speaking-test/backend/data_loader.js`)
- Test API → Image delivery: serves images (evidence: `speaking-test/backend/index.js`)
- Recording flow → Image delivery: builds image URLs (evidence: `speaking-test/frontend/src/SpeechTestLogic.js`)
- Session coordinator → Test API: fetches final (evidence: `speaking-test/frontend/src/App.js`)
