# liyuan551408-bot/coursecompass architecture

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

- Interactive diagram: https://gitdiagram.com/liyuan551408-bot/coursecompass
- Repository: https://github.com/liyuan551408-bot/coursecompass

## Overview

CourseCompass supports students through course discovery, comparison, saving, completed-course tracking, semester planning, reviews, and AI-assisted recommendations; moderators and administrators handle governance. The graph shows the frontend-to-API boundary, backend routing and domain services, AI retrieval and explanation, and persistence. Some frontend API-to-backend and unsampled subsystem links are left unverified because the excerpts do not show their wiring.

Main entry points: [`frontend/src/api`](https://github.com/liyuan551408-bot/coursecompass/tree/master/frontend/src/api) (Frontend API clients), [`backend/src/lib/prisma.js`](https://github.com/liyuan551408-bot/coursecompass/blob/master/backend/src/lib/prisma.js) (Prisma client), [`backend/src/controllers`](https://github.com/liyuan551408-bot/coursecompass/tree/master/backend/src/controllers) (Domain controllers), [`backend/src/services/courseService.js`](https://github.com/liyuan551408-bot/coursecompass/blob/master/backend/src/services/courseService.js) (Course and subject services)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_student["Student experience"]
  node_router["Page routing<br/>[index.js]"]
  node_course_views["Course discovery and comparison"]
  node_planner_view["Semester planning<br/>[Planner.vue]"]
  node_frontend_api["Frontend API clients"]
end

subgraph group_governance["Accounts and governance"]
  node_auth_store["Session state<br/>[auth.js]"]
  node_review_views["Review submission<br/>[ReviewSubmit.vue]"]
  node_moderation_admin["Moderation and administration"]
  node_auth_backend["Authentication and user services"]
  node_review_backend["Review and report services<br/>[reviewService.js]"]
end

subgraph group_backend["Backend domain services"]
  node_course_backend["Course and subject services<br/>[courseService.js]"]
  node_plan_backend["Planning and completed study"]
  node_saved_notify["Saved courses and notifications"]
end

subgraph group_ai["AI recommendations"]
  node_ai_controller["AI request orchestration<br/>[aiController.js]"]
  node_ai_retrieval["Semantic course retrieval"]
  node_ai_embedding["Course embeddings"]
  node_ai_explanation["AI explanation and comparison<br/>[llmService.js]"]
end

subgraph group_platform["API and persistence"]
  node_express["Express API<br/>[app.js]"]
  node_api_routes["API route handlers"]
  node_controllers["Domain controllers"]
  node_prisma["Prisma client<br/>[prisma.js]"]
  node_postgres[("PostgreSQL + pgvector")]
end

node_student_actor(("Student"))
node_moderator_actor(("Moderator / admin"))
node_embedding_provider["SiliconFlow embeddings"]
node_llm_provider["Zhipu AI"]

node_student_actor -->|"navigates"| node_router
node_moderator_actor -->|"manages reviews"| node_moderation_admin
node_router -->|"routes to"| node_course_views
node_student_actor -->|"searches and compares"| node_course_views
node_student_actor -->|"plans semesters"| node_planner_view
node_course_views -->|"requests course data"| node_frontend_api
node_planner_view -->|"requests courses"| node_frontend_api
node_planner_view -->|"uses planner state"| node_plan_backend
node_auth_store -->|"calls auth API"| node_frontend_api
node_review_views -->|"submits reviews"| node_frontend_api
node_moderation_admin -.->|"uses admin APIs"| node_frontend_api
node_frontend_api -.->|"calls API"| node_express
node_express -->|"mounts routes"| node_api_routes
node_api_routes -->|"dispatches requests"| node_controllers
node_controllers -->|"delegates account work"| node_auth_backend
node_controllers -->|"delegates course work"| node_course_backend
node_controllers -->|"delegates review work"| node_review_backend
node_controllers -->|"delegates plan work"| node_plan_backend
node_review_backend -->|"creates notifications"| node_saved_notify
node_ai_controller -->|"retrieves candidates"| node_ai_retrieval
node_ai_controller -->|"loads comparison courses"| node_course_backend
node_ai_controller -->|"requests analysis"| node_ai_explanation
node_ai_retrieval -->|"generates query vectors"| node_ai_embedding
node_ai_embedding -.->|"requests embeddings"| node_embedding_provider
node_ai_explanation -.->|"requests completions"| node_llm_provider
node_course_backend -->|"prepares embeddings"| node_ai_embedding
node_course_backend -->|"reads and writes"| node_prisma
node_ai_retrieval -->|"queries courses"| node_prisma
node_prisma -->|"persists data"| node_postgres
node_auth_backend -.->|"accesses user data"| node_prisma
node_plan_backend -.->|"accesses study data"| node_prisma
node_review_backend -->|"reads and writes reviews"| node_prisma

click node_router "https://github.com/liyuan551408-bot/coursecompass/blob/master/frontend/src/router/index.js"
click node_course_views "https://github.com/liyuan551408-bot/coursecompass/tree/master/frontend/src/views"
click node_planner_view "https://github.com/liyuan551408-bot/coursecompass/blob/master/frontend/src/views/Planner.vue"
click node_frontend_api "https://github.com/liyuan551408-bot/coursecompass/tree/master/frontend/src/api"
click node_auth_store "https://github.com/liyuan551408-bot/coursecompass/blob/master/frontend/src/stores/auth.js"
click node_review_views "https://github.com/liyuan551408-bot/coursecompass/blob/master/frontend/src/views/ReviewSubmit.vue"
click node_moderation_admin "https://github.com/liyuan551408-bot/coursecompass/tree/master/frontend/src/views"
click node_auth_backend "https://github.com/liyuan551408-bot/coursecompass/tree/master/backend/src/services"
click node_review_backend "https://github.com/liyuan551408-bot/coursecompass/blob/master/backend/src/services/reviewService.js"
click node_course_backend "https://github.com/liyuan551408-bot/coursecompass/blob/master/backend/src/services/courseService.js"
click node_plan_backend "https://github.com/liyuan551408-bot/coursecompass/tree/master/backend/src/services"
click node_saved_notify "https://github.com/liyuan551408-bot/coursecompass/tree/master/backend/src/services"
click node_ai_controller "https://github.com/liyuan551408-bot/coursecompass/blob/master/backend/src/controllers/aiController.js"
click node_ai_retrieval "https://github.com/liyuan551408-bot/coursecompass/blob/master/backend/src/services/courseRetrievalService.js"
click node_ai_embedding "https://github.com/liyuan551408-bot/coursecompass/blob/master/backend/src/services/courseEmbeddingService.js"
click node_ai_explanation "https://github.com/liyuan551408-bot/coursecompass/blob/master/backend/src/services/llmService.js"
click node_express "https://github.com/liyuan551408-bot/coursecompass/blob/master/backend/app.js"
click node_api_routes "https://github.com/liyuan551408-bot/coursecompass/tree/master/backend/src/routes"
click node_controllers "https://github.com/liyuan551408-bot/coursecompass/tree/master/backend/src/controllers"
click node_prisma "https://github.com/liyuan551408-bot/coursecompass/blob/master/backend/src/lib/prisma.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_router,node_course_views,node_planner_view,node_frontend_api toneBlue
class node_auth_store,node_review_views,node_moderation_admin,node_auth_backend,node_review_backend toneAmber
class node_course_backend,node_plan_backend,node_saved_notify toneMint
class node_ai_controller,node_ai_retrieval,node_ai_embedding,node_ai_explanation toneRose
class node_express,node_api_routes,node_controllers,node_prisma,node_postgres,node_student_actor,node_moderator_actor,node_embedding_provider,node_llm_provider toneIndigo
```

## Components

### Student experience

- [Page routing](https://github.com/liyuan551408-bot/coursecompass/blob/master/frontend/src/router/index.js): `frontend/src/router/index.js`
- [Course discovery and comparison](https://github.com/liyuan551408-bot/coursecompass/tree/master/frontend/src/views): `frontend/src/views`
- [Semester planning](https://github.com/liyuan551408-bot/coursecompass/blob/master/frontend/src/views/Planner.vue): `frontend/src/views/Planner.vue`
- [Frontend API clients](https://github.com/liyuan551408-bot/coursecompass/tree/master/frontend/src/api): `frontend/src/api`

### Accounts and governance

- [Session state](https://github.com/liyuan551408-bot/coursecompass/blob/master/frontend/src/stores/auth.js): `frontend/src/stores/auth.js`
- [Review submission](https://github.com/liyuan551408-bot/coursecompass/blob/master/frontend/src/views/ReviewSubmit.vue): `frontend/src/views/ReviewSubmit.vue`
- [Moderation and administration](https://github.com/liyuan551408-bot/coursecompass/tree/master/frontend/src/views): `frontend/src/views`
- [Authentication and user services](https://github.com/liyuan551408-bot/coursecompass/tree/master/backend/src/services): `backend/src/services`
- [Review and report services](https://github.com/liyuan551408-bot/coursecompass/blob/master/backend/src/services/reviewService.js): `backend/src/services/reviewService.js`

### Backend domain services

- [Course and subject services](https://github.com/liyuan551408-bot/coursecompass/blob/master/backend/src/services/courseService.js): `backend/src/services/courseService.js`
- [Planning and completed study](https://github.com/liyuan551408-bot/coursecompass/tree/master/backend/src/services): `backend/src/services`
- [Saved courses and notifications](https://github.com/liyuan551408-bot/coursecompass/tree/master/backend/src/services): `backend/src/services`

### AI recommendations

- [AI request orchestration](https://github.com/liyuan551408-bot/coursecompass/blob/master/backend/src/controllers/aiController.js): `backend/src/controllers/aiController.js`
- [Semantic course retrieval](https://github.com/liyuan551408-bot/coursecompass/blob/master/backend/src/services/courseRetrievalService.js): `backend/src/services/courseRetrievalService.js`
- [Course embeddings](https://github.com/liyuan551408-bot/coursecompass/blob/master/backend/src/services/courseEmbeddingService.js): `backend/src/services/courseEmbeddingService.js`
- [AI explanation and comparison](https://github.com/liyuan551408-bot/coursecompass/blob/master/backend/src/services/llmService.js): `backend/src/services/llmService.js`

### API and persistence

- [Express API](https://github.com/liyuan551408-bot/coursecompass/blob/master/backend/app.js): `backend/app.js`
- [API route handlers](https://github.com/liyuan551408-bot/coursecompass/tree/master/backend/src/routes): `backend/src/routes`
- [Domain controllers](https://github.com/liyuan551408-bot/coursecompass/tree/master/backend/src/controllers): `backend/src/controllers`
- [Prisma client](https://github.com/liyuan551408-bot/coursecompass/blob/master/backend/src/lib/prisma.js): `backend/src/lib/prisma.js`
- **PostgreSQL + pgvector**

### Other components

- **Student**
- **Moderator / admin**
- **SiliconFlow embeddings**
- **Zhipu AI**

## Connections

- Student → Page routing: navigates (evidence: `frontend/src/router/index.js`)
- Moderator / admin → Moderation and administration: manages reviews (evidence: `README.md`)
- Page routing → Course discovery and comparison: routes to (evidence: `frontend/src/router/index.js`)
- Student → Course discovery and comparison: searches and compares (evidence: `README.md`)
- Student → Semester planning: plans semesters (evidence: `README.md`)
- Course discovery and comparison → Frontend API clients: requests course data (evidence: `frontend/src/views/CompareCourses.vue`)
- Semester planning → Frontend API clients: requests courses (evidence: `frontend/src/views/Planner.vue`)
- Semester planning → Planning and completed study: uses planner state (evidence: `frontend/src/views/Planner.vue`)
- Session state → Frontend API clients: calls auth API (evidence: `frontend/src/stores/auth.js`)
- Review submission → Frontend API clients: submits reviews (evidence: `frontend/src/views/ReviewSubmit.vue`)
- Moderation and administration → Frontend API clients: uses admin APIs (evidence: `frontend/src/views/ReviewSubmit.vue`)
- Frontend API clients → Express API: calls API
- Express API → API route handlers: mounts routes (evidence: `backend/app.js`)
- API route handlers → Domain controllers: dispatches requests (evidence: `backend/src/routes/reviewRoutes.js`)
- Domain controllers → Authentication and user services: delegates account work (evidence: `backend/src/controllers/authController.js`)
- Domain controllers → Course and subject services: delegates course work (evidence: `backend/src/controllers/courseController.js`)
- Domain controllers → Review and report services: delegates review work (evidence: `backend/src/controllers/reviewController.js`)
- Domain controllers → Planning and completed study: delegates plan work (evidence: `backend/src/controllers/planController.js`)
- Review and report services → Saved courses and notifications: creates notifications (evidence: `backend/src/services/reviewService.js`)
- AI request orchestration → Semantic course retrieval: retrieves candidates (evidence: `backend/src/controllers/aiController.js`)
- AI request orchestration → Course and subject services: loads comparison courses (evidence: `backend/src/controllers/aiController.js`)
- AI request orchestration → AI explanation and comparison: requests analysis (evidence: `backend/src/controllers/aiController.js`)
- Semantic course retrieval → Course embeddings: generates query vectors (evidence: `backend/src/services/courseRetrievalService.js`)
- Course embeddings → SiliconFlow embeddings: requests embeddings
- AI explanation and comparison → Zhipu AI: requests completions
- Course and subject services → Course embeddings: prepares embeddings (evidence: `backend/src/services/courseService.js`)
- Course and subject services → Prisma client: reads and writes (evidence: `backend/src/services/courseService.js`)
- Semantic course retrieval → Prisma client: queries courses (evidence: `backend/src/services/courseRetrievalService.js`)
- Prisma client → PostgreSQL + pgvector: persists data (evidence: `README.md`)
- Authentication and user services → Prisma client: accesses user data (evidence: `backend/src/services/reviewService.js`)
- Planning and completed study → Prisma client: accesses study data (evidence: `backend/src/services/reviewService.js`)
- Review and report services → Prisma client: reads and writes reviews (evidence: `backend/src/services/reviewService.js`)
