# onon094/student_service architecture

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

- Interactive diagram: https://gitdiagram.com/onon094/student_service
- Repository: https://github.com/onon094/student_service

## Overview

粤教服务 is a multi-agent education and overseas-study service system: React provides the public site and role-based workspace, FastAPI enforces business rules and persists records, and Dify can orchestrate backend tools. A typical user submits a request through the interface, which reaches a domain API, is checked and processed by its service, and may read or write SQLite before a result returns. Documented capabilities include student services, counseling and alerts, employee CRM, courses and events, recommendations, and read-only natural-language SQL. Some frontend and domain implementation details were not sampled; their subsystem paths and links are included only where the README or source index supports them.

Main entry points: [`app/main.py`](https://github.com/onon094/student_service/blob/main/app/main.py) (FastAPI composition), [`app/shared/db.py`](https://github.com/onon094/student_service/blob/main/app/shared/db.py) (SQLite persistence), [`frontend/src/App.jsx`](https://github.com/onon094/student_service/blob/main/frontend/src/App.jsx) (Website and workspace), [`app/student/internal/service.py`](https://github.com/onon094/student_service/blob/main/app/student/internal/service.py) (Student services)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Web experience"]
  node_frontend["Website and workspace<br/>[App.jsx]"]
  node_site["Public site<br/>[Site.jsx]"]
  node_workspace["Role workspace<br/>[Workspace.jsx]"]
  node_panels["Service panels<br/>[panels.jsx]"]
  node_chat["Support chat<br/>[ChatWidget.jsx]"]
end

subgraph group_backend["Backend entry"]
  node_api["FastAPI composition<br/>[main.py]"]
  node_authorization["Request authorization<br/>[deps.py]"]
end

subgraph group_domains["Education services"]
  node_identity["Identity and login<br/>[service.py]"]
  node_student["Student services<br/>[service.py]"]
  node_psych["Counseling and alerts<br/>[service.py]"]
  node_employee["CRM and reports<br/>[service.py]"]
  node_catalog["Courses and events<br/>[service.py]"]
end

subgraph group_data["Shared data and identity"]
  node_sqlite[("SQLite persistence<br/>[db.py]")]
  node_config["Runtime configuration<br/>[config.py]"]
end

subgraph group_intelligence["AI capabilities"]
  node_recommend["Profile recommendations<br/>[service.py]"]
  node_nl2sql["Read-only NL2SQL<br/>[service.py]"]
end

node_user(("Students and staff"))
node_visitor(("Public visitor"))
node_dify{{"Dify agents"}}
node_model{{"Configured LLM provider"}}

node_visitor -->|"visits"| node_frontend
node_user -->|"uses"| node_frontend
node_frontend -->|"renders"| node_site
node_frontend -->|"renders"| node_workspace
node_workspace -.->|"shows"| node_panels
node_frontend -->|"renders"| node_chat
node_frontend -->|"calls endpoints"| node_api
node_dify -->|"invokes tools"| node_api
node_api -->|"uses permissions"| node_authorization
node_api -->|"registers routes"| node_identity
node_api -->|"registers routes"| node_student
node_api -->|"registers routes"| node_psych
node_api -->|"registers routes"| node_employee
node_api -->|"registers routes"| node_catalog
node_api -->|"registers routes"| node_recommend
node_api -->|"registers routes"| node_nl2sql
node_student -->|"validates students"| node_identity
node_psych -->|"validates students"| node_identity
node_employee -->|"manages accounts"| node_identity
node_employee -->|"creates enrollment"| node_student
node_student -->|"checks projects"| node_catalog
node_recommend -->|"gets catalog"| node_catalog
node_identity -->|"reads and writes"| node_sqlite
node_student -->|"reads and writes"| node_sqlite
node_psych -->|"reads and writes"| node_sqlite
node_employee -->|"reads and writes"| node_sqlite
node_catalog -->|"reads and writes"| node_sqlite
node_nl2sql -->|"executes SELECT"| node_sqlite
node_nl2sql -->|"requests SQL"| node_model
node_api -->|"loads settings"| node_config
node_sqlite -->|"gets DB path"| node_config

click node_frontend "https://github.com/onon094/student_service/blob/main/frontend/src/App.jsx"
click node_site "https://github.com/onon094/student_service/blob/main/frontend/src/Site.jsx"
click node_workspace "https://github.com/onon094/student_service/blob/main/frontend/src/Workspace.jsx"
click node_panels "https://github.com/onon094/student_service/blob/main/frontend/src/panels.jsx"
click node_chat "https://github.com/onon094/student_service/blob/main/frontend/src/ChatWidget.jsx"
click node_api "https://github.com/onon094/student_service/blob/main/app/main.py"
click node_authorization "https://github.com/onon094/student_service/blob/main/app/shared/deps.py"
click node_identity "https://github.com/onon094/student_service/blob/main/app/identity/internal/service.py"
click node_student "https://github.com/onon094/student_service/blob/main/app/student/internal/service.py"
click node_psych "https://github.com/onon094/student_service/blob/main/app/psych/internal/service.py"
click node_employee "https://github.com/onon094/student_service/blob/main/app/employee/internal/service.py"
click node_catalog "https://github.com/onon094/student_service/blob/main/app/catalog/internal/service.py"
click node_recommend "https://github.com/onon094/student_service/blob/main/app/recommend/internal/service.py"
click node_nl2sql "https://github.com/onon094/student_service/blob/main/app/nl2sql/internal/service.py"
click node_sqlite "https://github.com/onon094/student_service/blob/main/app/shared/db.py"
click node_config "https://github.com/onon094/student_service/blob/main/app/shared/config.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_frontend,node_site,node_workspace,node_panels,node_chat toneBlue
class node_api,node_authorization toneAmber
class node_identity,node_student,node_psych,node_employee,node_catalog toneMint
class node_sqlite,node_config toneRose
class node_recommend,node_nl2sql,node_user,node_visitor,node_dify,node_model toneIndigo
```

## Components

### Web experience

- [Website and workspace](https://github.com/onon094/student_service/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Public site](https://github.com/onon094/student_service/blob/main/frontend/src/Site.jsx): `frontend/src/Site.jsx`
- [Role workspace](https://github.com/onon094/student_service/blob/main/frontend/src/Workspace.jsx): `frontend/src/Workspace.jsx`
- [Service panels](https://github.com/onon094/student_service/blob/main/frontend/src/panels.jsx): `frontend/src/panels.jsx`
- [Support chat](https://github.com/onon094/student_service/blob/main/frontend/src/ChatWidget.jsx): `frontend/src/ChatWidget.jsx`

### Backend entry

- [FastAPI composition](https://github.com/onon094/student_service/blob/main/app/main.py): `app/main.py`
- [Request authorization](https://github.com/onon094/student_service/blob/main/app/shared/deps.py): `app/shared/deps.py`

### Education services

- [Identity and login](https://github.com/onon094/student_service/blob/main/app/identity/internal/service.py): `app/identity/internal/service.py`
- [Student services](https://github.com/onon094/student_service/blob/main/app/student/internal/service.py): `app/student/internal/service.py`
- [Counseling and alerts](https://github.com/onon094/student_service/blob/main/app/psych/internal/service.py): `app/psych/internal/service.py`
- [CRM and reports](https://github.com/onon094/student_service/blob/main/app/employee/internal/service.py): `app/employee/internal/service.py`
- [Courses and events](https://github.com/onon094/student_service/blob/main/app/catalog/internal/service.py): `app/catalog/internal/service.py`

### Shared data and identity

- [SQLite persistence](https://github.com/onon094/student_service/blob/main/app/shared/db.py): `app/shared/db.py`
- [Runtime configuration](https://github.com/onon094/student_service/blob/main/app/shared/config.py): `app/shared/config.py`

### AI capabilities

- [Profile recommendations](https://github.com/onon094/student_service/blob/main/app/recommend/internal/service.py): `app/recommend/internal/service.py`
- [Read-only NL2SQL](https://github.com/onon094/student_service/blob/main/app/nl2sql/internal/service.py): `app/nl2sql/internal/service.py`

### Other components

- **Students and staff**
- **Public visitor**
- **Dify agents**
- **Configured LLM provider**

## Connections

- Public visitor → Website and workspace: visits (evidence: `README.md`)
- Students and staff → Website and workspace: uses (evidence: `README.md`)
- Website and workspace → Public site: renders (evidence: `frontend/src/App.jsx`)
- Website and workspace → Role workspace: renders (evidence: `frontend/src/App.jsx`)
- Role workspace → Service panels: shows
- Website and workspace → Support chat: renders (evidence: `frontend/src/App.jsx`)
- Website and workspace → FastAPI composition: calls endpoints (evidence: `app/main.py`)
- Dify agents → FastAPI composition: invokes tools (evidence: `README.md`)
- FastAPI composition → Request authorization: uses permissions (evidence: `app/main.py`)
- FastAPI composition → Identity and login: registers routes (evidence: `app/main.py`)
- FastAPI composition → Student services: registers routes (evidence: `app/main.py`)
- FastAPI composition → Counseling and alerts: registers routes (evidence: `app/main.py`)
- FastAPI composition → CRM and reports: registers routes (evidence: `app/main.py`)
- FastAPI composition → Courses and events: registers routes (evidence: `app/main.py`)
- FastAPI composition → Profile recommendations: registers routes (evidence: `app/main.py`)
- FastAPI composition → Read-only NL2SQL: registers routes (evidence: `app/main.py`)
- Student services → Identity and login: validates students (evidence: `app/student/internal/service.py`)
- Counseling and alerts → Identity and login: validates students (evidence: `app/psych/internal/service.py`)
- CRM and reports → Identity and login: manages accounts (evidence: `app/employee/internal/service.py`)
- CRM and reports → Student services: creates enrollment (evidence: `app/employee/internal/service.py`)
- Student services → Courses and events: checks projects (evidence: `app/student/internal/service.py`)
- Profile recommendations → Courses and events: gets catalog (evidence: `app/recommend/internal/service.py`)
- Identity and login → SQLite persistence: reads and writes
- Student services → SQLite persistence: reads and writes
- Counseling and alerts → SQLite persistence: reads and writes
- CRM and reports → SQLite persistence: reads and writes
- Courses and events → SQLite persistence: reads and writes
- Read-only NL2SQL → SQLite persistence: executes SELECT (evidence: `app/nl2sql/internal/service.py`)
- Read-only NL2SQL → Configured LLM provider: requests SQL (evidence: `app/nl2sql/internal/service.py`)
- FastAPI composition → Runtime configuration: loads settings (evidence: `app/main.py`)
- SQLite persistence → Runtime configuration: gets DB path (evidence: `app/shared/db.py`)
