# ljiah/learning-english architecture

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

- Interactive diagram: https://gitdiagram.com/ljiah/learning-english
- Repository: https://github.com/ljiah/learning-english

## Overview

Learning English is an AI-driven English-learning platform: learners use the Vue app for AI chat, vocabulary practice, courses and account features, backed by separate business and AI NestJS services. The graph also shows shared infrastructure and the tracker SDK. README documents the broader feature set; source excerpts confirm selected call paths, so unsampled subsystem connections are shown only where documented.

Main entry points: [`apps/web/src/App.vue`](https://github.com/ljiah/learning-english/blob/master/apps/web/src/App.vue) (App shell), [`apps/web/src/views/Course/index.vue`](https://github.com/ljiah/learning-english/blob/master/apps/web/src/views/Course/index.vue) (Course learning), [`server/apps/server/src/user/user.service.ts`](https://github.com/ljiah/learning-english/blob/master/server/apps/server/src/user/user.service.ts) (User and authentication), [`server/apps/ai/src/chat/chat.service.ts`](https://github.com/ljiah/learning-english/blob/master/server/apps/ai/src/chat/chat.service.ts) (Chat orchestration)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web app"]
  node_webapp["App shell<br/>[App.vue]"]
  node_login["Login and account UI<br/>[index.vue]"]
  node_userstore["User state<br/>[user.ts]"]
  node_chatui["AI chat UI<br/>[index.vue]"]
  node_wordui["Vocabulary practice<br/>[index.vue]"]
  node_courseui["Course learning<br/>[index.vue]"]
  node_payui["Course purchase UI<br/>[Pay.vue]"]
end

subgraph group_business["Business service"]
  node_businessapi["Business API<br/>[main.ts]"]
  node_auth["User and authentication<br/>[user.service.ts]"]
  node_userdto["User request validation"]
  node_wordbook["Word-book service"]
  node_courses["Course service<br/>[course.service.ts]"]
  node_learning["Learning progress<br/>[learn.service.ts]"]
  node_payments["Payment service<br/>[pay.service.ts]"]
  node_socket["Payment notifications<br/>[socket.gateway.ts]"]
  node_trackapi["Tracker API"]
  node_trackservice["Tracker ingestion<br/>[tracker.service.ts]"]
end

subgraph group_ai["AI service"]
  node_aiapi["AI API<br/>[chat.controller.ts]"]
  node_aichat["Chat orchestration<br/>[chat.service.ts]"]
  node_prompts["Chat modes and prompts<br/>[prompt.mode.ts]"]
  node_llm["LLM configuration<br/>[llm.config.ts]"]
  node_digest["Daily word reports<br/>[digest.service.ts]"]
end

subgraph group_shared["Shared services"]
  node_database[("PostgreSQL")]
  node_minio[("MinIO object storage")]
  node_email["SMTP email"]
end

subgraph group_tracking["Usage tracking"]
  node_tracker["Tracker SDK<br/>[index.ts]"]
  node_fingerprint["Visitor fingerprint<br/>[index.ts]"]
  node_trackingevents["PV, events, errors, vitals"]
end

node_learner(("Learner"))

node_learner -->|"uses"| node_webapp
node_webapp -->|"opens"| node_login
node_login -->|"registers or logs in"| node_auth
node_auth -->|"validates requests"| node_userdto
node_webapp -->|"tracks user state"| node_userstore
node_learner -->|"chats"| node_chatui
node_chatui -->|"streams chat"| node_aiapi
node_aiapi -->|"calls"| node_aichat
node_aichat -->|"uses modes"| node_prompts
node_aichat -->|"uses model config"| node_llm
node_learner -->|"practices vocabulary"| node_wordui
node_wordui -->|"loads words and progress"| node_wordbook
node_learner -->|"learns courses"| node_courseui
node_courseui -->|"loads courses"| node_courses
node_courseui -->|"records learning progress"| node_learning
node_learner -->|"purchases courses"| node_payui
node_payui -->|"creates orders"| node_payments
node_payments -->|"notifies payment success"| node_socket
node_businessapi -.->|"uses Prisma data"| node_database
node_auth -.->|"stores avatars"| node_minio
node_digest -.->|"sends daily reports"| node_email
node_learner -->|"triggers tracking"| node_webapp
node_webapp -->|"initializes"| node_tracker
node_tracker -->|"gets visitor ID"| node_fingerprint
node_tracker -->|"starts collectors"| node_trackingevents
node_trackingevents -->|"reports events"| node_trackapi
node_trackapi -->|"delegates ingestion"| node_trackservice

click node_webapp "https://github.com/ljiah/learning-english/blob/master/apps/web/src/App.vue"
click node_login "https://github.com/ljiah/learning-english/blob/master/apps/web/src/components/Login/index.vue"
click node_userstore "https://github.com/ljiah/learning-english/blob/master/apps/web/src/stores/user.ts"
click node_chatui "https://github.com/ljiah/learning-english/blob/master/apps/web/src/views/Chat/index.vue"
click node_wordui "https://github.com/ljiah/learning-english/blob/master/apps/web/src/views/WordBook/index.vue"
click node_courseui "https://github.com/ljiah/learning-english/blob/master/apps/web/src/views/Course/index.vue"
click node_payui "https://github.com/ljiah/learning-english/blob/master/apps/web/src/views/Course/components/Pay.vue"
click node_businessapi "https://github.com/ljiah/learning-english/blob/master/server/apps/server/src/main.ts"
click node_auth "https://github.com/ljiah/learning-english/blob/master/server/apps/server/src/user/user.service.ts"
click node_userdto "https://github.com/ljiah/learning-english/tree/master/server/apps/server/src/user/dto"
click node_wordbook "https://github.com/ljiah/learning-english/blob/master/server/apps/server/src/word-book/word-book.service.ts"
click node_courses "https://github.com/ljiah/learning-english/blob/master/server/apps/server/src/course/course.service.ts"
click node_learning "https://github.com/ljiah/learning-english/blob/master/server/apps/server/src/learn/learn.service.ts"
click node_payments "https://github.com/ljiah/learning-english/blob/master/server/apps/server/src/pay/pay.service.ts"
click node_socket "https://github.com/ljiah/learning-english/blob/master/server/apps/server/src/socket/socket.gateway.ts"
click node_aiapi "https://github.com/ljiah/learning-english/blob/master/server/apps/ai/src/chat/chat.controller.ts"
click node_aichat "https://github.com/ljiah/learning-english/blob/master/server/apps/ai/src/chat/chat.service.ts"
click node_prompts "https://github.com/ljiah/learning-english/blob/master/server/apps/ai/src/prompt/prompt.mode.ts"
click node_llm "https://github.com/ljiah/learning-english/blob/master/server/apps/ai/src/llm/llm.config.ts"
click node_digest "https://github.com/ljiah/learning-english/blob/master/server/apps/ai/src/digest/digest.service.ts"
click node_tracker "https://github.com/ljiah/learning-english/blob/master/apps/tracker/index.ts"
click node_fingerprint "https://github.com/ljiah/learning-english/blob/master/apps/tracker/src/uv/index.ts"
click node_trackingevents "https://github.com/ljiah/learning-english/tree/master/apps/tracker/src"
click node_trackapi "https://github.com/ljiah/learning-english/blob/master/server/apps/server/src/tracker/tracker.controller.ts"
click node_trackservice "https://github.com/ljiah/learning-english/blob/master/server/apps/server/src/tracker/tracker.service.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_webapp,node_login,node_userstore,node_chatui,node_wordui,node_courseui,node_payui toneBlue
class node_businessapi,node_auth,node_userdto,node_wordbook,node_courses,node_learning,node_payments,node_socket,node_trackapi,node_trackservice toneAmber
class node_aiapi,node_aichat,node_prompts,node_llm,node_digest toneMint
class node_database,node_minio,node_email toneRose
class node_tracker,node_fingerprint,node_trackingevents,node_learner toneIndigo
```

## Components

### Web app

- [App shell](https://github.com/ljiah/learning-english/blob/master/apps/web/src/App.vue): `apps/web/src/App.vue`
- [Login and account UI](https://github.com/ljiah/learning-english/blob/master/apps/web/src/components/Login/index.vue): `apps/web/src/components/Login/index.vue`
- [User state](https://github.com/ljiah/learning-english/blob/master/apps/web/src/stores/user.ts): `apps/web/src/stores/user.ts`
- [AI chat UI](https://github.com/ljiah/learning-english/blob/master/apps/web/src/views/Chat/index.vue): `apps/web/src/views/Chat/index.vue`
- [Vocabulary practice](https://github.com/ljiah/learning-english/blob/master/apps/web/src/views/WordBook/index.vue): `apps/web/src/views/WordBook/index.vue`
- [Course learning](https://github.com/ljiah/learning-english/blob/master/apps/web/src/views/Course/index.vue): `apps/web/src/views/Course/index.vue`
- [Course purchase UI](https://github.com/ljiah/learning-english/blob/master/apps/web/src/views/Course/components/Pay.vue): `apps/web/src/views/Course/components/Pay.vue`

### Business service

- [Business API](https://github.com/ljiah/learning-english/blob/master/server/apps/server/src/main.ts): `server/apps/server/src/main.ts`
- [User and authentication](https://github.com/ljiah/learning-english/blob/master/server/apps/server/src/user/user.service.ts): `server/apps/server/src/user/user.service.ts`
- [User request validation](https://github.com/ljiah/learning-english/tree/master/server/apps/server/src/user/dto): `server/apps/server/src/user/dto`
- [Word-book service](https://github.com/ljiah/learning-english/blob/master/server/apps/server/src/word-book/word-book.service.ts): `server/apps/server/src/word-book/word-book.service.ts`
- [Course service](https://github.com/ljiah/learning-english/blob/master/server/apps/server/src/course/course.service.ts): `server/apps/server/src/course/course.service.ts`
- [Learning progress](https://github.com/ljiah/learning-english/blob/master/server/apps/server/src/learn/learn.service.ts): `server/apps/server/src/learn/learn.service.ts`
- [Payment service](https://github.com/ljiah/learning-english/blob/master/server/apps/server/src/pay/pay.service.ts): `server/apps/server/src/pay/pay.service.ts`
- [Payment notifications](https://github.com/ljiah/learning-english/blob/master/server/apps/server/src/socket/socket.gateway.ts): `server/apps/server/src/socket/socket.gateway.ts`
- [Tracker API](https://github.com/ljiah/learning-english/blob/master/server/apps/server/src/tracker/tracker.controller.ts): `server/apps/server/src/tracker/tracker.controller.ts`
- [Tracker ingestion](https://github.com/ljiah/learning-english/blob/master/server/apps/server/src/tracker/tracker.service.ts): `server/apps/server/src/tracker/tracker.service.ts`

### AI service

- [AI API](https://github.com/ljiah/learning-english/blob/master/server/apps/ai/src/chat/chat.controller.ts): `server/apps/ai/src/chat/chat.controller.ts`
- [Chat orchestration](https://github.com/ljiah/learning-english/blob/master/server/apps/ai/src/chat/chat.service.ts): `server/apps/ai/src/chat/chat.service.ts`
- [Chat modes and prompts](https://github.com/ljiah/learning-english/blob/master/server/apps/ai/src/prompt/prompt.mode.ts): `server/apps/ai/src/prompt/prompt.mode.ts`
- [LLM configuration](https://github.com/ljiah/learning-english/blob/master/server/apps/ai/src/llm/llm.config.ts): `server/apps/ai/src/llm/llm.config.ts`
- [Daily word reports](https://github.com/ljiah/learning-english/blob/master/server/apps/ai/src/digest/digest.service.ts): `server/apps/ai/src/digest/digest.service.ts`

### Shared services

- **PostgreSQL**
- **MinIO object storage**
- **SMTP email**

### Usage tracking

- [Tracker SDK](https://github.com/ljiah/learning-english/blob/master/apps/tracker/index.ts): `apps/tracker/index.ts`
- [Visitor fingerprint](https://github.com/ljiah/learning-english/blob/master/apps/tracker/src/uv/index.ts): `apps/tracker/src/uv/index.ts`
- [PV, events, errors, vitals](https://github.com/ljiah/learning-english/tree/master/apps/tracker/src): `apps/tracker/src`

### Other components

- **Learner**

## Connections

- Learner → App shell: uses
- App shell → Login and account UI: opens (evidence: `apps/web/src/App.vue`)
- Login and account UI → User and authentication: registers or logs in
- User and authentication → User request validation: validates requests (evidence: `server/apps/server/src/user/user.controller.ts`)
- App shell → User state: tracks user state (evidence: `apps/web/src/App.vue`)
- Learner → AI chat UI: chats
- AI chat UI → AI API: streams chat
- AI API → Chat orchestration: calls (evidence: `server/apps/ai/src/chat/chat.controller.ts`)
- Chat orchestration → Chat modes and prompts: uses modes (evidence: `server/apps/ai/src/chat/chat.service.ts`)
- Chat orchestration → LLM configuration: uses model config (evidence: `server/apps/ai/src/chat/chat.service.ts`)
- Learner → Vocabulary practice: practices vocabulary
- Vocabulary practice → Word-book service: loads words and progress
- Learner → Course learning: learns courses
- Course learning → Course service: loads courses
- Course learning → Learning progress: records learning progress
- Learner → Course purchase UI: purchases courses
- Course purchase UI → Payment service: creates orders
- Payment service → Payment notifications: notifies payment success (evidence: `server/apps/server/src/pay/pay.service.ts`)
- Business API → PostgreSQL: uses Prisma data
- User and authentication → MinIO object storage: stores avatars
- Daily word reports → SMTP email: sends daily reports
- Learner → App shell: triggers tracking (evidence: `apps/web/src/App.vue`)
- App shell → Tracker SDK: initializes (evidence: `apps/web/src/App.vue`)
- Tracker SDK → Visitor fingerprint: gets visitor ID (evidence: `apps/tracker/index.ts`)
- Tracker SDK → PV, events, errors, vitals: starts collectors (evidence: `apps/tracker/index.ts`)
- PV, events, errors, vitals → Tracker API: reports events
- Tracker API → Tracker ingestion: delegates ingestion (evidence: `server/apps/server/src/tracker/tracker.controller.ts`)
