# ngothitho2021-byte/ngo_thi_tho_cong_nghe_phan_mem_24ct2_learn-english-web architecture

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

- Interactive diagram: https://gitdiagram.com/ngothitho2021-byte/ngo_thi_tho_cong_nghe_phan_mem_24ct2_learn-english-web
- Repository: https://github.com/ngothitho2021-byte/ngo_thi_tho_cong_nghe_phan_mem_24ct2_learn-english-web

## Overview

Học Từ Đầu is an English-learning website whose main learner workflow is choosing a skill and lesson, then practicing vocabulary, listening, speaking, or writing. Speaking uses browser speech recognition and AI feedback; writing receives AI feedback through the backend. The backend also handles registration, login, profile lookup, and level updates. The README documents the frontend-to-API workflows; sampled backend source confirms routing, authentication, persistence, and AI calls. Lesson-page wiring was not sampled, so frontend relationships are based on README descriptions rather than inspected page code.

Main entry points: [`backend/routes/auth.py`](https://github.com/ngothitho2021-byte/ngo_thi_tho_cong_nghe_phan_mem_24ct2_learn-english-web/blob/main/backend/routes/auth.py) (Account endpoints), [`backend/main.py`](https://github.com/ngothitho2021-byte/ngo_thi_tho_cong_nghe_phan_mem_24ct2_learn-english-web/blob/main/backend/main.py) (FastAPI application), [`backend/database.py`](https://github.com/ngothitho2021-byte/ngo_thi_tho_cong_nghe_phan_mem_24ct2_learn-english-web/blob/main/backend/database.py) (Database sessions), [`backend/routes/ai.py`](https://github.com/ngothitho2021-byte/ngo_thi_tho_cong_nghe_phan_mem_24ct2_learn-english-web/blob/main/backend/routes/ai.py) (AI endpoints)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_learning["Learning experience"]
  node_home["Home page<br/>[index.html]"]
  node_vocab_catalog["Vocabulary lessons<br/>[tu-vung.html]"]
  node_vocab_lesson["Vocabulary practice"]
  node_vocab_logic["Vocabulary interactions<br/>[tu-vung-bai-hoc.js]"]
  node_listening_catalog["Listening lessons<br/>[nghe.html]"]
  node_listening_lesson["Listening practice<br/>[nghe-bai-hoc.html]"]
  node_listening_logic["Listening interactions<br/>[nghe-bai-hoc.js]"]
  node_speaking_catalog["Speaking lessons<br/>[noi.html]"]
  node_speaking_lesson["Speaking practice<br/>[noi-bai-hoc.html]"]
  node_speaking_logic["Speech and answers<br/>[noi-bai-hoc.js]"]
  node_writing_catalog["Writing lessons<br/>[viet.html]"]
  node_writing_lesson["Writing practice<br/>[viet-bai-hoc.html]"]
  node_writing_logic["Writing interactions<br/>[viet-bai-hoc.js]"]
end

subgraph group_account["Account frontend"]
  node_auth_pages["Login and signup<br/>[login.html]"]
  node_auth_frontend["Auth and token client<br/>[auth.js]"]
end

subgraph group_api["API services"]
  node_api_app["FastAPI application<br/>[main.py]"]
  node_auth_routes["Account endpoints<br/>[auth.py]"]
  node_schemas["Account schemas<br/>[schemas.py]"]
end

subgraph group_identity["Identity and storage"]
  node_security["Password and JWT<br/>[security.py]"]
  node_user_model["User model<br/>[models.py]"]
  node_db_session["Database sessions<br/>[database.py]"]
  node_sqlite[("SQLite database")]
end

subgraph group_ai["AI feedback"]
  node_ai_routes["AI endpoints<br/>[ai.py]"]
end

node_learner(("Learner"))
node_speech_api{{"Web Speech API"}}
node_groq{{"Groq AI service"}}

node_learner -->|"opens"| node_home
node_learner -->|"chooses vocabulary"| node_vocab_catalog
node_learner -->|"chooses listening"| node_listening_catalog
node_learner -->|"chooses speaking"| node_speaking_catalog
node_learner -->|"chooses writing"| node_writing_catalog
node_vocab_catalog -->|"opens lesson"| node_vocab_lesson
node_vocab_lesson -->|"uses interactions"| node_vocab_logic
node_listening_catalog -->|"opens lesson"| node_listening_lesson
node_listening_lesson -->|"uses interactions"| node_listening_logic
node_speaking_catalog -->|"opens lesson"| node_speaking_lesson
node_speaking_lesson -->|"uses interactions"| node_speaking_logic
node_speaking_logic -->|"recognizes speech"| node_speech_api
node_writing_catalog -->|"opens lesson"| node_writing_lesson
node_writing_lesson -->|"uses interactions"| node_writing_logic
node_auth_pages -->|"submits credentials"| node_auth_frontend
node_auth_frontend -->|"sends REST requests"| node_api_app
node_speaking_logic -->|"sends answer"| node_ai_routes
node_writing_logic -->|"sends writing"| node_ai_routes
node_api_app -->|"registers router"| node_auth_routes
node_api_app -->|"registers router"| node_ai_routes
node_api_app -->|"creates tables"| node_db_session
node_auth_routes -->|"validates and returns"| node_schemas
node_auth_routes -->|"hashes and verifies"| node_security
node_auth_routes -->|"queries and updates"| node_user_model
node_auth_routes -->|"opens sessions"| node_db_session
node_user_model -->|"uses Base"| node_db_session
node_db_session -->|"connects to"| node_sqlite
node_ai_routes -->|"calls API"| node_groq

click node_home "https://github.com/ngothitho2021-byte/ngo_thi_tho_cong_nghe_phan_mem_24ct2_learn-english-web/blob/main/index.html"
click node_vocab_catalog "https://github.com/ngothitho2021-byte/ngo_thi_tho_cong_nghe_phan_mem_24ct2_learn-english-web/blob/main/pages/tu-vung.html"
click node_vocab_lesson "https://github.com/ngothitho2021-byte/ngo_thi_tho_cong_nghe_phan_mem_24ct2_learn-english-web/blob/main/pages/tu-vung-bai-hoc.html"
click node_vocab_logic "https://github.com/ngothitho2021-byte/ngo_thi_tho_cong_nghe_phan_mem_24ct2_learn-english-web/blob/main/assets/js/tu-vung-bai-hoc.js"
click node_listening_catalog "https://github.com/ngothitho2021-byte/ngo_thi_tho_cong_nghe_phan_mem_24ct2_learn-english-web/blob/main/pages/nghe.html"
click node_listening_lesson "https://github.com/ngothitho2021-byte/ngo_thi_tho_cong_nghe_phan_mem_24ct2_learn-english-web/blob/main/pages/nghe-bai-hoc.html"
click node_listening_logic "https://github.com/ngothitho2021-byte/ngo_thi_tho_cong_nghe_phan_mem_24ct2_learn-english-web/blob/main/assets/js/nghe-bai-hoc.js"
click node_speaking_catalog "https://github.com/ngothitho2021-byte/ngo_thi_tho_cong_nghe_phan_mem_24ct2_learn-english-web/blob/main/pages/noi.html"
click node_speaking_lesson "https://github.com/ngothitho2021-byte/ngo_thi_tho_cong_nghe_phan_mem_24ct2_learn-english-web/blob/main/pages/noi-bai-hoc.html"
click node_speaking_logic "https://github.com/ngothitho2021-byte/ngo_thi_tho_cong_nghe_phan_mem_24ct2_learn-english-web/blob/main/assets/js/noi-bai-hoc.js"
click node_writing_catalog "https://github.com/ngothitho2021-byte/ngo_thi_tho_cong_nghe_phan_mem_24ct2_learn-english-web/blob/main/pages/viet.html"
click node_writing_lesson "https://github.com/ngothitho2021-byte/ngo_thi_tho_cong_nghe_phan_mem_24ct2_learn-english-web/blob/main/pages/viet-bai-hoc.html"
click node_writing_logic "https://github.com/ngothitho2021-byte/ngo_thi_tho_cong_nghe_phan_mem_24ct2_learn-english-web/blob/main/assets/js/viet-bai-hoc.js"
click node_auth_pages "https://github.com/ngothitho2021-byte/ngo_thi_tho_cong_nghe_phan_mem_24ct2_learn-english-web/blob/main/login.html"
click node_auth_frontend "https://github.com/ngothitho2021-byte/ngo_thi_tho_cong_nghe_phan_mem_24ct2_learn-english-web/blob/main/assets/js/auth.js"
click node_api_app "https://github.com/ngothitho2021-byte/ngo_thi_tho_cong_nghe_phan_mem_24ct2_learn-english-web/blob/main/backend/main.py"
click node_auth_routes "https://github.com/ngothitho2021-byte/ngo_thi_tho_cong_nghe_phan_mem_24ct2_learn-english-web/blob/main/backend/routes/auth.py"
click node_ai_routes "https://github.com/ngothitho2021-byte/ngo_thi_tho_cong_nghe_phan_mem_24ct2_learn-english-web/blob/main/backend/routes/ai.py"
click node_schemas "https://github.com/ngothitho2021-byte/ngo_thi_tho_cong_nghe_phan_mem_24ct2_learn-english-web/blob/main/backend/schemas.py"
click node_security "https://github.com/ngothitho2021-byte/ngo_thi_tho_cong_nghe_phan_mem_24ct2_learn-english-web/blob/main/backend/security.py"
click node_user_model "https://github.com/ngothitho2021-byte/ngo_thi_tho_cong_nghe_phan_mem_24ct2_learn-english-web/blob/main/backend/models.py"
click node_db_session "https://github.com/ngothitho2021-byte/ngo_thi_tho_cong_nghe_phan_mem_24ct2_learn-english-web/blob/main/backend/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_home,node_vocab_catalog,node_vocab_lesson,node_vocab_logic,node_listening_catalog,node_listening_lesson,node_listening_logic,node_speaking_catalog,node_speaking_lesson,node_speaking_logic,node_writing_catalog,node_writing_lesson,node_writing_logic toneBlue
class node_auth_pages,node_auth_frontend toneAmber
class node_api_app,node_auth_routes,node_schemas,node_speech_api toneMint
class node_security,node_user_model,node_db_session,node_sqlite toneRose
class node_ai_routes,node_learner,node_groq toneIndigo
```

## Components

### Learning experience

- [Home page](https://github.com/ngothitho2021-byte/ngo_thi_tho_cong_nghe_phan_mem_24ct2_learn-english-web/blob/main/index.html): `index.html`
- [Vocabulary lessons](https://github.com/ngothitho2021-byte/ngo_thi_tho_cong_nghe_phan_mem_24ct2_learn-english-web/blob/main/pages/tu-vung.html): `pages/tu-vung.html`
- [Vocabulary practice](https://github.com/ngothitho2021-byte/ngo_thi_tho_cong_nghe_phan_mem_24ct2_learn-english-web/blob/main/pages/tu-vung-bai-hoc.html): `pages/tu-vung-bai-hoc.html`
- [Vocabulary interactions](https://github.com/ngothitho2021-byte/ngo_thi_tho_cong_nghe_phan_mem_24ct2_learn-english-web/blob/main/assets/js/tu-vung-bai-hoc.js): `assets/js/tu-vung-bai-hoc.js`
- [Listening lessons](https://github.com/ngothitho2021-byte/ngo_thi_tho_cong_nghe_phan_mem_24ct2_learn-english-web/blob/main/pages/nghe.html): `pages/nghe.html`
- [Listening practice](https://github.com/ngothitho2021-byte/ngo_thi_tho_cong_nghe_phan_mem_24ct2_learn-english-web/blob/main/pages/nghe-bai-hoc.html): `pages/nghe-bai-hoc.html`
- [Listening interactions](https://github.com/ngothitho2021-byte/ngo_thi_tho_cong_nghe_phan_mem_24ct2_learn-english-web/blob/main/assets/js/nghe-bai-hoc.js): `assets/js/nghe-bai-hoc.js`
- [Speaking lessons](https://github.com/ngothitho2021-byte/ngo_thi_tho_cong_nghe_phan_mem_24ct2_learn-english-web/blob/main/pages/noi.html): `pages/noi.html`
- [Speaking practice](https://github.com/ngothitho2021-byte/ngo_thi_tho_cong_nghe_phan_mem_24ct2_learn-english-web/blob/main/pages/noi-bai-hoc.html): `pages/noi-bai-hoc.html`
- [Speech and answers](https://github.com/ngothitho2021-byte/ngo_thi_tho_cong_nghe_phan_mem_24ct2_learn-english-web/blob/main/assets/js/noi-bai-hoc.js): `assets/js/noi-bai-hoc.js`
- [Writing lessons](https://github.com/ngothitho2021-byte/ngo_thi_tho_cong_nghe_phan_mem_24ct2_learn-english-web/blob/main/pages/viet.html): `pages/viet.html`
- [Writing practice](https://github.com/ngothitho2021-byte/ngo_thi_tho_cong_nghe_phan_mem_24ct2_learn-english-web/blob/main/pages/viet-bai-hoc.html): `pages/viet-bai-hoc.html`
- [Writing interactions](https://github.com/ngothitho2021-byte/ngo_thi_tho_cong_nghe_phan_mem_24ct2_learn-english-web/blob/main/assets/js/viet-bai-hoc.js): `assets/js/viet-bai-hoc.js`

### Account frontend

- [Login and signup](https://github.com/ngothitho2021-byte/ngo_thi_tho_cong_nghe_phan_mem_24ct2_learn-english-web/blob/main/login.html): `login.html`
- [Auth and token client](https://github.com/ngothitho2021-byte/ngo_thi_tho_cong_nghe_phan_mem_24ct2_learn-english-web/blob/main/assets/js/auth.js): `assets/js/auth.js`

### API services

- [FastAPI application](https://github.com/ngothitho2021-byte/ngo_thi_tho_cong_nghe_phan_mem_24ct2_learn-english-web/blob/main/backend/main.py): `backend/main.py`
- [Account endpoints](https://github.com/ngothitho2021-byte/ngo_thi_tho_cong_nghe_phan_mem_24ct2_learn-english-web/blob/main/backend/routes/auth.py): `backend/routes/auth.py`
- [Account schemas](https://github.com/ngothitho2021-byte/ngo_thi_tho_cong_nghe_phan_mem_24ct2_learn-english-web/blob/main/backend/schemas.py): `backend/schemas.py`

### Identity and storage

- [Password and JWT](https://github.com/ngothitho2021-byte/ngo_thi_tho_cong_nghe_phan_mem_24ct2_learn-english-web/blob/main/backend/security.py): `backend/security.py`
- [User model](https://github.com/ngothitho2021-byte/ngo_thi_tho_cong_nghe_phan_mem_24ct2_learn-english-web/blob/main/backend/models.py): `backend/models.py`
- [Database sessions](https://github.com/ngothitho2021-byte/ngo_thi_tho_cong_nghe_phan_mem_24ct2_learn-english-web/blob/main/backend/database.py): `backend/database.py`
- **SQLite database**

### AI feedback

- [AI endpoints](https://github.com/ngothitho2021-byte/ngo_thi_tho_cong_nghe_phan_mem_24ct2_learn-english-web/blob/main/backend/routes/ai.py): `backend/routes/ai.py`

### Other components

- **Learner**
- **Web Speech API**
- **Groq AI service**

## Connections

- Learner → Home page: opens (evidence: `README.md`)
- Learner → Vocabulary lessons: chooses vocabulary (evidence: `README.md`)
- Learner → Listening lessons: chooses listening (evidence: `README.md`)
- Learner → Speaking lessons: chooses speaking (evidence: `README.md`)
- Learner → Writing lessons: chooses writing (evidence: `README.md`)
- Vocabulary lessons → Vocabulary practice: opens lesson (evidence: `README.md`)
- Vocabulary practice → Vocabulary interactions: uses interactions (evidence: `README.md`)
- Listening lessons → Listening practice: opens lesson (evidence: `README.md`)
- Listening practice → Listening interactions: uses interactions (evidence: `README.md`)
- Speaking lessons → Speaking practice: opens lesson (evidence: `README.md`)
- Speaking practice → Speech and answers: uses interactions (evidence: `README.md`)
- Speech and answers → Web Speech API: recognizes speech (evidence: `README.md`)
- Writing lessons → Writing practice: opens lesson (evidence: `README.md`)
- Writing practice → Writing interactions: uses interactions (evidence: `README.md`)
- Login and signup → Auth and token client: submits credentials (evidence: `README.md`)
- Auth and token client → FastAPI application: sends REST requests (evidence: `README.md`)
- Speech and answers → AI endpoints: sends answer (evidence: `README.md`)
- Writing interactions → AI endpoints: sends writing (evidence: `README.md`)
- FastAPI application → Account endpoints: registers router (evidence: `backend/main.py`)
- FastAPI application → AI endpoints: registers router (evidence: `backend/main.py`)
- FastAPI application → Database sessions: creates tables (evidence: `backend/main.py`)
- Account endpoints → Account schemas: validates and returns (evidence: `backend/routes/auth.py`)
- Account endpoints → Password and JWT: hashes and verifies (evidence: `backend/routes/auth.py`)
- Account endpoints → User model: queries and updates (evidence: `backend/routes/auth.py`)
- Account endpoints → Database sessions: opens sessions (evidence: `backend/routes/auth.py`)
- User model → Database sessions: uses Base (evidence: `backend/models.py`)
- Database sessions → SQLite database: connects to (evidence: `backend/database.py`)
- AI endpoints → Groq AI service: calls API (evidence: `backend/routes/ai.py`)
