# liwei1214/fyp architecture

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

- Interactive diagram: https://gitdiagram.com/liwei1214/fyp
- Repository: https://github.com/liwei1214/fyp

## Overview

This is a role-based learning progress web app: students authenticate, then manage notes, to-dos and learning goals from a dashboard; lecturers access material and quiz features. The React client calls an Express API, whose route/controller layers handle authentication, student records, categories, and lecturer resources backed by a database. OCR is an additional, documented-but-not-fully-functional note-creation capability. The graph reflects the sampled routes and controllers; goal-setting details and some client-to-endpoint wiring are not shown in the excerpts.

Main entry points: [`server/server.js`](https://github.com/liwei1214/fyp/blob/main/server/server.js) (Express application), [`client/src/App.js`](https://github.com/liwei1214/fyp/blob/main/client/src/App.js) (App routes), [`server/db/db.js`](https://github.com/liwei1214/fyp/blob/main/server/db/db.js) (Application database), [`server/routes/userRoutes.js`](https://github.com/liwei1214/fyp/blob/main/server/routes/userRoutes.js) (User routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["React client"]
  node_app["App routes<br/>[App.js]"]
  node_dashboard["Student dashboard<br/>[Home.js]"]
  node_notes_ui["Notes editor<br/>[NoteEditorPage.js]"]
  node_todos_ui["To-do lists<br/>[ToDoList.js]"]
  node_lecturer_ui["Lecturer materials<br/>[UploadMaterial.js]"]
  node_api_client["API service<br/>[apiService.js]"]
end

subgraph group_api["API and auth"]
  node_server["Express application<br/>[server.js]"]
  node_auth_routes["User routes<br/>[userRoutes.js]"]
  node_user_controller["Account operations<br/>[userController.js]"]
  node_profile_routes["Profile routes<br/>[profileRoutes.js]"]
  node_category_routes["Category routes<br/>[categoryRoutes.js]"]
  node_lecturer_routes["Lecturer routes<br/>[lecturerRoutes.js]"]
  node_auth_middleware["Authentication guard<br/>[authMiddleware.js]"]
end

subgraph group_learning["Learning features"]
  node_student_controller["Student activities"]
  node_database[("Application database<br/>[db.js]")]
end

subgraph group_resources["Resources and OCR"]
  node_category_controller["Categories and materials"]
  node_lecturer_controller["Material and quiz management"]
  node_ocr["OCR processor<br/>[ocr_processor.py]"]
end

node_learner(("Student or lecturer"))
node_image_service["Tesseract OCR"]

node_learner -->|"uses"| node_app
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_notes_ui
node_app -->|"routes to"| node_todos_ui
node_app -->|"routes to"| node_lecturer_ui
node_notes_ui -->|"requests notes"| node_api_client
node_todos_ui -->|"requests lists"| node_api_client
node_lecturer_ui -->|"uploads materials"| node_api_client
node_api_client -->|"sends API requests"| node_server
node_server -->|"mounts"| node_auth_routes
node_server -->|"mounts"| node_profile_routes
node_server -->|"mounts"| node_category_routes
node_server -->|"mounts"| node_lecturer_routes
node_server -->|"runs OCR"| node_ocr
node_server -.->|"fallback OCR"| node_image_service
node_auth_routes -->|"dispatches account requests"| node_user_controller
node_auth_routes -->|"dispatches activity requests"| node_student_controller
node_profile_routes -->|"guards profile access"| node_auth_middleware
node_profile_routes -->|"reads and updates users"| node_database
node_auth_routes -->|"guards activity routes"| node_auth_middleware
node_user_controller -->|"reads and writes accounts"| node_database
node_student_controller -->|"reads and writes learning data"| node_database
node_category_routes -->|"guards routes"| node_auth_middleware
node_category_routes -->|"dispatches category requests"| node_category_controller
node_category_routes -->|"dispatches material uploads"| node_lecturer_controller
node_category_controller -->|"reads and writes categories"| node_database
node_lecturer_routes -->|"guards material routes"| node_auth_middleware
node_lecturer_routes -->|"dispatches material and quiz requests"| node_lecturer_controller
node_lecturer_controller -->|"stores materials and quizzes"| node_database

click node_app "https://github.com/liwei1214/fyp/blob/main/client/src/App.js"
click node_dashboard "https://github.com/liwei1214/fyp/blob/main/client/src/pages/Home.js"
click node_notes_ui "https://github.com/liwei1214/fyp/blob/main/client/src/pages/NoteEditorPage.js"
click node_todos_ui "https://github.com/liwei1214/fyp/blob/main/client/src/pages/ToDoList.js"
click node_lecturer_ui "https://github.com/liwei1214/fyp/blob/main/client/src/pages/UploadMaterial.js"
click node_api_client "https://github.com/liwei1214/fyp/blob/main/client/src/services/apiService.js"
click node_server "https://github.com/liwei1214/fyp/blob/main/server/server.js"
click node_auth_routes "https://github.com/liwei1214/fyp/blob/main/server/routes/userRoutes.js"
click node_user_controller "https://github.com/liwei1214/fyp/blob/main/server/controller/userController.js"
click node_profile_routes "https://github.com/liwei1214/fyp/blob/main/server/routes/profileRoutes.js"
click node_category_routes "https://github.com/liwei1214/fyp/blob/main/server/routes/categoryRoutes.js"
click node_lecturer_routes "https://github.com/liwei1214/fyp/blob/main/server/routes/lecturerRoutes.js"
click node_auth_middleware "https://github.com/liwei1214/fyp/blob/main/server/middleware/authMiddleware.js"
click node_student_controller "https://github.com/liwei1214/fyp/blob/main/server/controller/studentController.js"
click node_database "https://github.com/liwei1214/fyp/blob/main/server/db/db.js"
click node_category_controller "https://github.com/liwei1214/fyp/blob/main/server/controller/categoryController.js"
click node_lecturer_controller "https://github.com/liwei1214/fyp/blob/main/server/controller/lecturerController.js"
click node_ocr "https://github.com/liwei1214/fyp/blob/main/server/ocr_processor.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_app,node_dashboard,node_notes_ui,node_todos_ui,node_lecturer_ui,node_api_client toneBlue
class node_server,node_auth_routes,node_user_controller,node_profile_routes,node_category_routes,node_lecturer_routes,node_auth_middleware toneAmber
class node_student_controller,node_database toneMint
class node_category_controller,node_lecturer_controller,node_ocr toneRose
class node_learner,node_image_service toneIndigo
```

## Components

### React client

- [App routes](https://github.com/liwei1214/fyp/blob/main/client/src/App.js): `client/src/App.js`
- [Student dashboard](https://github.com/liwei1214/fyp/blob/main/client/src/pages/Home.js): `client/src/pages/Home.js`
- [Notes editor](https://github.com/liwei1214/fyp/blob/main/client/src/pages/NoteEditorPage.js): `client/src/pages/NoteEditorPage.js`
- [To-do lists](https://github.com/liwei1214/fyp/blob/main/client/src/pages/ToDoList.js): `client/src/pages/ToDoList.js`
- [Lecturer materials](https://github.com/liwei1214/fyp/blob/main/client/src/pages/UploadMaterial.js): `client/src/pages/UploadMaterial.js`
- [API service](https://github.com/liwei1214/fyp/blob/main/client/src/services/apiService.js): `client/src/services/apiService.js`

### API and auth

- [Express application](https://github.com/liwei1214/fyp/blob/main/server/server.js): `server/server.js`
- [User routes](https://github.com/liwei1214/fyp/blob/main/server/routes/userRoutes.js): `server/routes/userRoutes.js`
- [Account operations](https://github.com/liwei1214/fyp/blob/main/server/controller/userController.js): `server/controller/userController.js`
- [Profile routes](https://github.com/liwei1214/fyp/blob/main/server/routes/profileRoutes.js): `server/routes/profileRoutes.js`
- [Category routes](https://github.com/liwei1214/fyp/blob/main/server/routes/categoryRoutes.js): `server/routes/categoryRoutes.js`
- [Lecturer routes](https://github.com/liwei1214/fyp/blob/main/server/routes/lecturerRoutes.js): `server/routes/lecturerRoutes.js`
- [Authentication guard](https://github.com/liwei1214/fyp/blob/main/server/middleware/authMiddleware.js): `server/middleware/authMiddleware.js`

### Learning features

- [Student activities](https://github.com/liwei1214/fyp/blob/main/server/controller/studentController.js): `server/controller/studentController.js`
- [Application database](https://github.com/liwei1214/fyp/blob/main/server/db/db.js): `server/db/db.js`

### Resources and OCR

- [Categories and materials](https://github.com/liwei1214/fyp/blob/main/server/controller/categoryController.js): `server/controller/categoryController.js`
- [Material and quiz management](https://github.com/liwei1214/fyp/blob/main/server/controller/lecturerController.js): `server/controller/lecturerController.js`
- [OCR processor](https://github.com/liwei1214/fyp/blob/main/server/ocr_processor.py): `server/ocr_processor.py`

### Other components

- **Student or lecturer**
- **Tesseract OCR**

## Connections

- Student or lecturer → App routes: uses
- App routes → Student dashboard: routes to
- App routes → Notes editor: routes to
- App routes → To-do lists: routes to
- App routes → Lecturer materials: routes to
- Notes editor → API service: requests notes
- To-do lists → API service: requests lists
- Lecturer materials → API service: uploads materials
- API service → Express application: sends API requests
- Express application → User routes: mounts
- Express application → Profile routes: mounts
- Express application → Category routes: mounts
- Express application → Lecturer routes: mounts
- Express application → OCR processor: runs OCR
- Express application → Tesseract OCR: fallback OCR
- User routes → Account operations: dispatches account requests
- User routes → Student activities: dispatches activity requests
- Profile routes → Authentication guard: guards profile access
- Profile routes → Application database: reads and updates users
- User routes → Authentication guard: guards activity routes
- Account operations → Application database: reads and writes accounts
- Student activities → Application database: reads and writes learning data
- Category routes → Authentication guard: guards routes
- Category routes → Categories and materials: dispatches category requests
- Category routes → Material and quiz management: dispatches material uploads
- Categories and materials → Application database: reads and writes categories
- Lecturer routes → Authentication guard: guards material routes
- Lecturer routes → Material and quiz management: dispatches material and quiz requests
- Material and quiz management → Application database: stores materials and quizzes
