# yuyuuxp/finalproject-web-yugyo architecture

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

- Interactive diagram: https://gitdiagram.com/yuyuuxp/finalproject-web-yugyo
- Repository: https://github.com/yuyuuxp/finalproject-web-yugyo

## Overview

Yugyo is a Next.js course-and-atelier platform with public course and teacher pages, student and instructor portals, and administrative management. The apparent user journey spans registration or login, course discovery/enrollment, course schedules and content, and student–teacher chat or discussion; administrators manage courses, categories, users, and schedules. The graph preserves these domain areas and the sampled database, media, and teacher-chat policy layers. UI-to-API wiring is not asserted where excerpts do not show it; several portal connections therefore remain unverified.

Main entry points: [`src/lib/db.js`](https://github.com/yuyuuxp/finalproject-web-yugyo/blob/main/src/lib/db.js) (PostgreSQL pool), [`src/lib/teacher-chat-scope.js`](https://github.com/yuyuuxp/finalproject-web-yugyo/blob/main/src/lib/teacher-chat-scope.js) (Teacher chat scoping), [`src/components/student`](https://github.com/yuyuuxp/finalproject-web-yugyo/tree/main/src/components/student) (Student portal), [`src/app/api/admin`](https://github.com/yuyuuxp/finalproject-web-yugyo/tree/main/src/app/api/admin) (Admin management API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access and discovery"]
  node_authpages["Sign in and register"]
  node_catalog["Course catalog"]
  node_teacherpublic["Teacher profiles"]
end

subgraph group_learning["Student learning"]
  node_studentportal["Student portal"]
  node_studentchats["Student chats"]
  node_studentcourses["Student courses"]
  node_studentschedule["Student schedule"]
end

subgraph group_teaching["Instructor workspace"]
  node_teacherportal["Teacher dashboard"]
  node_teachercourses["Course management"]
  node_teachercontents["Course content"]
  node_teacherschedule["Schedule management"]
  node_teacherprofile["Instructor profile"]
  node_teacherchatsui["Teacher chats<br/>[page.jsx]"]
end

subgraph group_admin["Administration"]
  node_adminportal["Admin console"]
end

subgraph group_runtime["Runtime services"]
  node_authapi["Authentication API"]
  node_registerapi["Registration API<br/>[route.js]"]
  node_adminapi["Admin management API"]
  node_teacherapi["Teacher API"]
  node_chatapi["Chat API<br/>[route.js]"]
  node_teacherchatapi["Teacher chat API<br/>[route.js]"]
  node_discussionapi["Discussion API<br/>[route.js]"]
  node_scheduleapi["Teacher schedule API<br/>[route.js]"]
  node_chatmessagesapi["Chat messages API<br/>[route.js]"]
  node_database[("PostgreSQL pool<br/>[db.js]")]
  node_media[("Local image storage<br/>[mediaStorage.js]")]
  node_chatscope["Teacher chat scoping"]
  node_chatfilter["Teacher chat filtering"]
  node_teacherstatus["Teacher status rules<br/>[teacher-status.js]"]
end

node_visitor(("Visitor"))

node_visitor -.->|"registers or signs in"| node_authpages
node_visitor -.->|"browses courses"| node_catalog
node_authapi -->|"queries users"| node_database
node_registerapi -->|"creates user"| node_database
node_adminapi -->|"manages records"| node_database
node_adminapi -->|"stores course images"| node_media
node_teacherapi -->|"manages courses"| node_database
node_teacherapi -->|"stores course images"| node_media
node_scheduleapi -->|"reads and updates sessions"| node_database
node_scheduleapi -->|"checks pending status"| node_teacherstatus
node_chatapi -->|"reads and updates threads"| node_database
node_teacherchatapi -->|"reads and writes messages"| node_database
node_discussionapi -->|"fetches discussions"| node_chatscope
node_discussionapi -->|"checks pending status"| node_teacherstatus
node_chatscope -->|"queries chat data"| node_database
node_chatscope -->|"filters teacher chats"| node_chatfilter
node_chatscope -->|"checks status"| node_teacherstatus
node_chatmessagesapi -->|"queries messages"| node_database
node_studentportal -.->|"renders courses"| node_studentcourses
node_studentportal -.->|"renders chats"| node_studentchats
node_studentportal -.->|"renders schedule"| node_studentschedule
node_teacherportal -.->|"renders courses"| node_teachercourses
node_teacherportal -.->|"renders schedule"| node_teacherschedule
node_adminportal -.->|"manages records"| node_adminapi
node_teacherchatsui -.->|"loads conversations"| node_teacherchatapi
node_studentchats -.->|"loads messages"| node_chatmessagesapi

click node_authpages "https://github.com/yuyuuxp/finalproject-web-yugyo/tree/main/src/app/(auth)"
click node_authapi "https://github.com/yuyuuxp/finalproject-web-yugyo/tree/main/src/app/api/auth"
click node_registerapi "https://github.com/yuyuuxp/finalproject-web-yugyo/blob/main/src/app/api/register/route.js"
click node_catalog "https://github.com/yuyuuxp/finalproject-web-yugyo/tree/main/src/app/(public)/courses"
click node_teacherpublic "https://github.com/yuyuuxp/finalproject-web-yugyo/tree/main/src/app/(public)/teachers"
click node_studentportal "https://github.com/yuyuuxp/finalproject-web-yugyo/tree/main/src/components/student"
click node_studentchats "https://github.com/yuyuuxp/finalproject-web-yugyo/blob/main/src/components/student/StudentChatsClient.jsx"
click node_studentcourses "https://github.com/yuyuuxp/finalproject-web-yugyo/blob/main/src/components/student/StudentCoursesClient.jsx"
click node_studentschedule "https://github.com/yuyuuxp/finalproject-web-yugyo/blob/main/src/components/student/StudentScheduleClient.jsx"
click node_teacherportal "https://github.com/yuyuuxp/finalproject-web-yugyo/blob/main/src/components/teacher/TeacherDashboardClient.jsx"
click node_teachercourses "https://github.com/yuyuuxp/finalproject-web-yugyo/blob/main/src/components/teacher/CourseManagementClient.jsx"
click node_teachercontents "https://github.com/yuyuuxp/finalproject-web-yugyo/blob/main/src/components/teacher/ContentManagementClient.jsx"
click node_teacherschedule "https://github.com/yuyuuxp/finalproject-web-yugyo/blob/main/src/components/teacher/TeacherScheduleClient.jsx"
click node_teacherprofile "https://github.com/yuyuuxp/finalproject-web-yugyo/blob/main/src/components/teacher/InstructorProfileClient.jsx"
click node_teacherchatsui "https://github.com/yuyuuxp/finalproject-web-yugyo/blob/main/src/app/dashboard/teacher/chats/page.jsx"
click node_adminportal "https://github.com/yuyuuxp/finalproject-web-yugyo/tree/main/src/app/dashboard/admin"
click node_adminapi "https://github.com/yuyuuxp/finalproject-web-yugyo/tree/main/src/app/api/admin"
click node_teacherapi "https://github.com/yuyuuxp/finalproject-web-yugyo/tree/main/src/app/api/teacher"
click node_chatapi "https://github.com/yuyuuxp/finalproject-web-yugyo/blob/main/src/app/api/chat/route.js"
click node_teacherchatapi "https://github.com/yuyuuxp/finalproject-web-yugyo/blob/main/src/app/api/teacher/chats/route.js"
click node_discussionapi "https://github.com/yuyuuxp/finalproject-web-yugyo/blob/main/src/app/api/teacher/discussion/route.js"
click node_scheduleapi "https://github.com/yuyuuxp/finalproject-web-yugyo/blob/main/src/app/api/teacher/schedule/route.js"
click node_chatmessagesapi "https://github.com/yuyuuxp/finalproject-web-yugyo/blob/main/src/app/api/chat/messages/route.js"
click node_database "https://github.com/yuyuuxp/finalproject-web-yugyo/blob/main/src/lib/db.js"
click node_media "https://github.com/yuyuuxp/finalproject-web-yugyo/blob/main/src/lib/mediaStorage.js"
click node_chatscope "https://github.com/yuyuuxp/finalproject-web-yugyo/blob/main/src/lib/teacher-chat-scope.js"
click node_chatfilter "https://github.com/yuyuuxp/finalproject-web-yugyo/blob/main/src/lib/teacher-chat-filter.js"
click node_teacherstatus "https://github.com/yuyuuxp/finalproject-web-yugyo/blob/main/src/lib/teacher-status.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_authpages,node_catalog,node_teacherpublic toneBlue
class node_studentportal,node_studentchats,node_studentcourses,node_studentschedule toneAmber
class node_teacherportal,node_teachercourses,node_teachercontents,node_teacherschedule,node_teacherprofile,node_teacherchatsui toneMint
class node_adminportal toneRose
class node_authapi,node_registerapi,node_adminapi,node_teacherapi,node_chatapi,node_teacherchatapi,node_discussionapi,node_scheduleapi,node_chatmessagesapi,node_database,node_media,node_chatscope,node_chatfilter,node_teacherstatus,node_visitor toneIndigo
```

## Components

### Access and discovery

- [Sign in and register](https://github.com/yuyuuxp/finalproject-web-yugyo/tree/main/src/app/(auth)): `src/app/(auth)`
- [Course catalog](https://github.com/yuyuuxp/finalproject-web-yugyo/tree/main/src/app/(public)/courses): `src/app/(public)/courses`
- [Teacher profiles](https://github.com/yuyuuxp/finalproject-web-yugyo/tree/main/src/app/(public)/teachers): `src/app/(public)/teachers`

### Student learning

- [Student portal](https://github.com/yuyuuxp/finalproject-web-yugyo/tree/main/src/components/student): `src/components/student`
- [Student chats](https://github.com/yuyuuxp/finalproject-web-yugyo/blob/main/src/components/student/StudentChatsClient.jsx): `src/components/student/StudentChatsClient.jsx`
- [Student courses](https://github.com/yuyuuxp/finalproject-web-yugyo/blob/main/src/components/student/StudentCoursesClient.jsx): `src/components/student/StudentCoursesClient.jsx`
- [Student schedule](https://github.com/yuyuuxp/finalproject-web-yugyo/blob/main/src/components/student/StudentScheduleClient.jsx): `src/components/student/StudentScheduleClient.jsx`

### Instructor workspace

- [Teacher dashboard](https://github.com/yuyuuxp/finalproject-web-yugyo/blob/main/src/components/teacher/TeacherDashboardClient.jsx): `src/components/teacher/TeacherDashboardClient.jsx`
- [Course management](https://github.com/yuyuuxp/finalproject-web-yugyo/blob/main/src/components/teacher/CourseManagementClient.jsx): `src/components/teacher/CourseManagementClient.jsx`
- [Course content](https://github.com/yuyuuxp/finalproject-web-yugyo/blob/main/src/components/teacher/ContentManagementClient.jsx): `src/components/teacher/ContentManagementClient.jsx`
- [Schedule management](https://github.com/yuyuuxp/finalproject-web-yugyo/blob/main/src/components/teacher/TeacherScheduleClient.jsx): `src/components/teacher/TeacherScheduleClient.jsx`
- [Instructor profile](https://github.com/yuyuuxp/finalproject-web-yugyo/blob/main/src/components/teacher/InstructorProfileClient.jsx): `src/components/teacher/InstructorProfileClient.jsx`
- [Teacher chats](https://github.com/yuyuuxp/finalproject-web-yugyo/blob/main/src/app/dashboard/teacher/chats/page.jsx): `src/app/dashboard/teacher/chats/page.jsx`

### Administration

- [Admin console](https://github.com/yuyuuxp/finalproject-web-yugyo/tree/main/src/app/dashboard/admin): `src/app/dashboard/admin`

### Runtime services

- [Authentication API](https://github.com/yuyuuxp/finalproject-web-yugyo/tree/main/src/app/api/auth): `src/app/api/auth`
- [Registration API](https://github.com/yuyuuxp/finalproject-web-yugyo/blob/main/src/app/api/register/route.js): `src/app/api/register/route.js`
- [Admin management API](https://github.com/yuyuuxp/finalproject-web-yugyo/tree/main/src/app/api/admin): `src/app/api/admin`
- [Teacher API](https://github.com/yuyuuxp/finalproject-web-yugyo/tree/main/src/app/api/teacher): `src/app/api/teacher`
- [Chat API](https://github.com/yuyuuxp/finalproject-web-yugyo/blob/main/src/app/api/chat/route.js): `src/app/api/chat/route.js`
- [Teacher chat API](https://github.com/yuyuuxp/finalproject-web-yugyo/blob/main/src/app/api/teacher/chats/route.js): `src/app/api/teacher/chats/route.js`
- [Discussion API](https://github.com/yuyuuxp/finalproject-web-yugyo/blob/main/src/app/api/teacher/discussion/route.js): `src/app/api/teacher/discussion/route.js`
- [Teacher schedule API](https://github.com/yuyuuxp/finalproject-web-yugyo/blob/main/src/app/api/teacher/schedule/route.js): `src/app/api/teacher/schedule/route.js`
- [Chat messages API](https://github.com/yuyuuxp/finalproject-web-yugyo/blob/main/src/app/api/chat/messages/route.js): `src/app/api/chat/messages/route.js`
- [PostgreSQL pool](https://github.com/yuyuuxp/finalproject-web-yugyo/blob/main/src/lib/db.js): `src/lib/db.js`
- [Local image storage](https://github.com/yuyuuxp/finalproject-web-yugyo/blob/main/src/lib/mediaStorage.js): `src/lib/mediaStorage.js`
- [Teacher chat scoping](https://github.com/yuyuuxp/finalproject-web-yugyo/blob/main/src/lib/teacher-chat-scope.js): `src/lib/teacher-chat-scope.js`
- [Teacher chat filtering](https://github.com/yuyuuxp/finalproject-web-yugyo/blob/main/src/lib/teacher-chat-filter.js): `src/lib/teacher-chat-filter.js`
- [Teacher status rules](https://github.com/yuyuuxp/finalproject-web-yugyo/blob/main/src/lib/teacher-status.js): `src/lib/teacher-status.js`

### Other components

- **Visitor**

## Connections

- Visitor → Sign in and register: registers or signs in
- Visitor → Course catalog: browses courses
- Authentication API → PostgreSQL pool: queries users (evidence: `src/app/api/auth/login/route.js`)
- Registration API → PostgreSQL pool: creates user (evidence: `src/app/api/register/route.js`)
- Admin management API → PostgreSQL pool: manages records (evidence: `src/app/api/admin/courses/route.js`)
- Admin management API → Local image storage: stores course images (evidence: `src/app/api/admin/courses/route.js`)
- Teacher API → PostgreSQL pool: manages courses (evidence: `src/app/api/teacher/courses/route.js`)
- Teacher API → Local image storage: stores course images (evidence: `src/app/api/teacher/courses/route.js`)
- Teacher schedule API → PostgreSQL pool: reads and updates sessions (evidence: `src/app/api/teacher/schedule/route.js`)
- Teacher schedule API → Teacher status rules: checks pending status (evidence: `src/app/api/teacher/schedule/route.js`)
- Chat API → PostgreSQL pool: reads and updates threads (evidence: `src/app/api/chat/route.js`)
- Teacher chat API → PostgreSQL pool: reads and writes messages (evidence: `src/app/api/teacher/chats/route.js`)
- Discussion API → Teacher chat scoping: fetches discussions (evidence: `src/app/api/teacher/discussion/route.js`)
- Discussion API → Teacher status rules: checks pending status (evidence: `src/app/api/teacher/discussion/route.js`)
- Teacher chat scoping → PostgreSQL pool: queries chat data (evidence: `src/lib/teacher-chat-scope.js`)
- Teacher chat scoping → Teacher chat filtering: filters teacher chats (evidence: `src/lib/teacher-chat-scope.js`)
- Teacher chat scoping → Teacher status rules: checks status (evidence: `src/lib/teacher-chat-scope.js`)
- Chat messages API → PostgreSQL pool: queries messages (evidence: `src/app/api/chat/messages/route.js`)
- Student portal → Student courses: renders courses
- Student portal → Student chats: renders chats
- Student portal → Student schedule: renders schedule
- Teacher dashboard → Course management: renders courses
- Teacher dashboard → Schedule management: renders schedule
- Admin console → Admin management API: manages records
- Teacher chats → Teacher chat API: loads conversations
- Student chats → Chat messages API: loads messages
