# minhsuy/e-learning architecture

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

- Interactive diagram: https://gitdiagram.com/minhsuy/e-learning
- Repository: https://github.com/minhsuy/e-learning

## Overview

TMDEMY is a learning platform with student, teacher, and administrator experiences. The visible student workflow spans sign-in, discovering courses, enrollment, learning, and tracking progress toward certificates; teacher and admin areas support course operations and oversight. The frontend uses a shared shell, authentication context, and API client/services. Several product branches are clear from the tree but their internal calls were not sampled, so those relationships are omitted rather than inferred.

Main entry points: [`src/lib/api/client.ts`](https://github.com/minhsuy/e-learning/blob/main/src/lib/api/client.ts) (API client), [`src/app/my-courses/page.tsx`](https://github.com/minhsuy/e-learning/blob/main/src/app/my-courses/page.tsx) (My courses), [`src/contexts/auth-context.tsx`](https://github.com/minhsuy/e-learning/blob/main/src/contexts/auth-context.tsx) (Auth state), [`src/services/auth.service.ts`](https://github.com/minhsuy/e-learning/blob/main/src/services/auth.service.ts) (Auth API service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_identity["Identity"]
  node_authpages["Sign-in and registration<br/>[page.tsx]"]
  node_authcontext["Auth state<br/>[auth-context.tsx]"]
  node_authservice["Auth API service<br/>[auth.service.ts]"]
  node_authcontract["Auth contracts<br/>[auth.ts]"]
end

subgraph group_learning["Student learning"]
  node_home["Home dashboard<br/>[page.tsx]"]
  node_catalog["Course catalog<br/>[page.tsx]"]
  node_course["Course detail<br/>[page.tsx]"]
  node_mycourses["My courses<br/>[page.tsx]"]
  node_learningroom["Lesson learning<br/>[page.tsx]"]
  node_enrollment["Enrollment service"]
  node_enrollmenttypes["Enrollment contracts<br/>[enrollment.ts]"]
  node_progress["Progress service"]
  node_certificates["Certificates<br/>[page.tsx]"]
  node_recommendations["Personalized recommendations"]
  node_messages["Messaging<br/>[page.tsx]"]
end

subgraph group_operations["Teacher and admin"]
  node_teacher["Teacher workspace"]
  node_admin["Admin workspace"]
end

subgraph group_platform["Shared platform"]
  node_shell["App shell<br/>[app-shell.tsx]"]
  node_apiclient["API client<br/>[client.ts]"]
  node_apitoken["Token handling<br/>[token.ts]"]
  node_apitypes["API contracts<br/>[api.ts]"]
end

node_user(("Learner"))
node_backend{{"TMDEMY API"}}

node_user -.->|"signs in"| node_authpages
node_authpages -.->|"uses auth"| node_authcontext
node_authcontext -->|"calls"| node_authservice
node_authservice -->|"uses contracts"| node_authcontract
node_authservice -->|"sends requests"| node_apiclient
node_authcontext -->|"manages tokens"| node_apitoken
node_user -.->|"opens"| node_home
node_home -->|"renders in"| node_shell
node_home -->|"renders"| node_recommendations
node_user -.->|"browses"| node_catalog
node_catalog -->|"renders in"| node_shell
node_catalog -.->|"requests courses"| node_backend
node_user -.->|"views course"| node_course
node_user -.->|"tracks enrollment"| node_mycourses
node_mycourses -->|"renders in"| node_shell
node_mycourses -->|"loads enrollments"| node_enrollment
node_mycourses -->|"loads progress"| node_progress
node_enrollment -->|"uses contracts"| node_enrollmenttypes
node_enrollment -->|"sends requests"| node_apiclient
node_progress -->|"sends requests"| node_apiclient
node_user -.->|"studies lessons"| node_learningroom
node_user -.->|"views certificates"| node_certificates
node_user -.->|"uses messaging"| node_messages
node_user -.->|"teaches"| node_teacher
node_user -.->|"administers"| node_admin
node_apiclient -->|"reads tokens"| node_apitoken
node_apiclient -->|"uses errors"| node_apitypes
node_apiclient -.->|"calls API"| node_backend

click node_authpages "https://github.com/minhsuy/e-learning/blob/main/src/app/(auth)/login/page.tsx"
click node_authcontext "https://github.com/minhsuy/e-learning/blob/main/src/contexts/auth-context.tsx"
click node_authservice "https://github.com/minhsuy/e-learning/blob/main/src/services/auth.service.ts"
click node_authcontract "https://github.com/minhsuy/e-learning/blob/main/src/types/auth.ts"
click node_home "https://github.com/minhsuy/e-learning/blob/main/src/app/page.tsx"
click node_catalog "https://github.com/minhsuy/e-learning/blob/main/src/app/courses/page.tsx"
click node_course "https://github.com/minhsuy/e-learning/blob/main/src/app/courses/%5Bslug%5D/page.tsx"
click node_mycourses "https://github.com/minhsuy/e-learning/blob/main/src/app/my-courses/page.tsx"
click node_learningroom "https://github.com/minhsuy/e-learning/blob/main/src/app/learn/%5Bslug%5D/page.tsx"
click node_enrollment "https://github.com/minhsuy/e-learning/blob/main/src/services/enrollment.service.ts"
click node_enrollmenttypes "https://github.com/minhsuy/e-learning/blob/main/src/types/enrollment.ts"
click node_progress "https://github.com/minhsuy/e-learning/blob/main/src/services/progress.service.ts"
click node_certificates "https://github.com/minhsuy/e-learning/blob/main/src/app/certificates/page.tsx"
click node_recommendations "https://github.com/minhsuy/e-learning/blob/main/src/components/home/personalized-recommendations-section.tsx"
click node_messages "https://github.com/minhsuy/e-learning/blob/main/src/app/messages/page.tsx"
click node_teacher "https://github.com/minhsuy/e-learning/tree/main/src/app/teacher"
click node_admin "https://github.com/minhsuy/e-learning/tree/main/src/app/admin"
click node_shell "https://github.com/minhsuy/e-learning/blob/main/src/components/layout/app-shell.tsx"
click node_apiclient "https://github.com/minhsuy/e-learning/blob/main/src/lib/api/client.ts"
click node_apitoken "https://github.com/minhsuy/e-learning/blob/main/src/lib/api/token.ts"
click node_apitypes "https://github.com/minhsuy/e-learning/blob/main/src/types/api.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_authpages,node_authcontext,node_authservice,node_authcontract toneBlue
class node_home,node_catalog,node_course,node_mycourses,node_learningroom,node_enrollment,node_enrollmenttypes,node_progress,node_certificates,node_recommendations,node_messages toneAmber
class node_teacher,node_admin,node_backend toneMint
class node_shell,node_apiclient,node_apitoken,node_apitypes toneRose
class node_user toneIndigo
```

## Components

### Identity

- [Sign-in and registration](https://github.com/minhsuy/e-learning/blob/main/src/app/(auth)/login/page.tsx): `src/app/(auth)/login/page.tsx`
- [Auth state](https://github.com/minhsuy/e-learning/blob/main/src/contexts/auth-context.tsx): `src/contexts/auth-context.tsx`
- [Auth API service](https://github.com/minhsuy/e-learning/blob/main/src/services/auth.service.ts): `src/services/auth.service.ts`
- [Auth contracts](https://github.com/minhsuy/e-learning/blob/main/src/types/auth.ts): `src/types/auth.ts`

### Student learning

- [Home dashboard](https://github.com/minhsuy/e-learning/blob/main/src/app/page.tsx): `src/app/page.tsx`
- [Course catalog](https://github.com/minhsuy/e-learning/blob/main/src/app/courses/page.tsx): `src/app/courses/page.tsx`
- [Course detail](https://github.com/minhsuy/e-learning/blob/main/src/app/courses/%5Bslug%5D/page.tsx): `src/app/courses/[slug]/page.tsx`
- [My courses](https://github.com/minhsuy/e-learning/blob/main/src/app/my-courses/page.tsx): `src/app/my-courses/page.tsx`
- [Lesson learning](https://github.com/minhsuy/e-learning/blob/main/src/app/learn/%5Bslug%5D/page.tsx): `src/app/learn/[slug]/page.tsx`
- [Enrollment service](https://github.com/minhsuy/e-learning/blob/main/src/services/enrollment.service.ts): `src/services/enrollment.service.ts`
- [Enrollment contracts](https://github.com/minhsuy/e-learning/blob/main/src/types/enrollment.ts): `src/types/enrollment.ts`
- [Progress service](https://github.com/minhsuy/e-learning/blob/main/src/services/progress.service.ts): `src/services/progress.service.ts`
- [Certificates](https://github.com/minhsuy/e-learning/blob/main/src/app/certificates/page.tsx): `src/app/certificates/page.tsx`
- [Personalized recommendations](https://github.com/minhsuy/e-learning/blob/main/src/components/home/personalized-recommendations-section.tsx): `src/components/home/personalized-recommendations-section.tsx`
- [Messaging](https://github.com/minhsuy/e-learning/blob/main/src/app/messages/page.tsx): `src/app/messages/page.tsx`

### Teacher and admin

- [Teacher workspace](https://github.com/minhsuy/e-learning/tree/main/src/app/teacher): `src/app/teacher`
- [Admin workspace](https://github.com/minhsuy/e-learning/tree/main/src/app/admin): `src/app/admin`

### Shared platform

- [App shell](https://github.com/minhsuy/e-learning/blob/main/src/components/layout/app-shell.tsx): `src/components/layout/app-shell.tsx`
- [API client](https://github.com/minhsuy/e-learning/blob/main/src/lib/api/client.ts): `src/lib/api/client.ts`
- [Token handling](https://github.com/minhsuy/e-learning/blob/main/src/lib/api/token.ts): `src/lib/api/token.ts`
- [API contracts](https://github.com/minhsuy/e-learning/blob/main/src/types/api.ts): `src/types/api.ts`

### Other components

- **Learner**
- **TMDEMY API**

## Connections

- Learner → Sign-in and registration: signs in
- Sign-in and registration → Auth state: uses auth
- Auth state → Auth API service: calls (evidence: `src/contexts/auth-context.tsx`)
- Auth API service → Auth contracts: uses contracts (evidence: `src/services/auth.service.ts`)
- Auth API service → API client: sends requests (evidence: `src/services/auth.service.ts`)
- Auth state → Token handling: manages tokens (evidence: `src/contexts/auth-context.tsx`)
- Learner → Home dashboard: opens
- Home dashboard → App shell: renders in (evidence: `src/app/page.tsx`)
- Home dashboard → Personalized recommendations: renders (evidence: `src/app/page.tsx`)
- Learner → Course catalog: browses
- Course catalog → App shell: renders in (evidence: `src/app/courses/page.tsx`)
- Course catalog → TMDEMY API: requests courses
- Learner → Course detail: views course
- Learner → My courses: tracks enrollment
- My courses → App shell: renders in (evidence: `src/app/my-courses/page.tsx`)
- My courses → Enrollment service: loads enrollments (evidence: `src/app/my-courses/page.tsx`)
- My courses → Progress service: loads progress (evidence: `src/app/my-courses/page.tsx`)
- Enrollment service → Enrollment contracts: uses contracts (evidence: `src/services/enrollment.service.ts`)
- Enrollment service → API client: sends requests (evidence: `src/services/enrollment.service.ts`)
- Progress service → API client: sends requests (evidence: `src/services/progress.service.ts`)
- Learner → Lesson learning: studies lessons
- Learner → Certificates: views certificates
- Learner → Messaging: uses messaging
- Learner → Teacher workspace: teaches
- Learner → Admin workspace: administers
- API client → Token handling: reads tokens (evidence: `src/lib/api/client.ts`)
- API client → API contracts: uses errors (evidence: `src/lib/api/client.ts`)
- API client → TMDEMY API: calls API
