# mxlitey/pai-docker architecture

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

- Interactive diagram: https://gitdiagram.com/mxlitey/pai-docker
- Repository: https://github.com/mxlitey/pai-docker

## Overview

This is a self-hosted education-center scheduling, administration, and billing system. Staff manage student and course records, enrollments, schedules, attendance, and transfers; the system supports reporting and parent access to schedules and feedback. The React app calls a Node HTTP server, which dispatches API modules into SQLite-backed stores. The graph preserves the README’s major operational, financial, reporting, collaboration, and system-management capabilities. Sampled source confirms the server/API/store pattern and enrollment updates; several other subsystem links follow documented API and product behavior rather than inspected implementation.

Main entry points: [`node-functions/api`](https://github.com/mxlitey/pai-docker/tree/main/node-functions/api) (API routes), [`node-functions/_lib/store/core.js`](https://github.com/mxlitey/pai-docker/blob/main/node-functions/_lib/store/core.js) (SQLite database), [`src/App.tsx`](https://github.com/mxlitey/pai-docker/blob/main/src/App.tsx) (React app), [`src/api/index.ts`](https://github.com/mxlitey/pai-docker/blob/main/src/api/index.ts) (API client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web application"]
  node_browser["React app<br/>[App.tsx]"]
  node_public["Search and calendar<br/>[PublicSearch.tsx]"]
  node_parentui["Parent H5<br/>[ParentH5.tsx]"]
  node_adminui["Admin workspace<br/>[AdminPanel.tsx]"]
  node_clientapi["API client<br/>[index.ts]"]
end

subgraph group_service["HTTP and access"]
  node_server["HTTP server<br/>[server.js]"]
  node_auth["Auth and RBAC<br/>[auth.js]"]
  node_api["API routes"]
end

subgraph group_operations["Teaching operations"]
  node_enrollment["Enrollment and billing<br/>[enrollments.js]"]
  node_schedule["Scheduling and changes<br/>[schedules.js]"]
  node_attendance["Attendance<br/>[attendance.js]"]
  node_feedback["Teacher feedback<br/>[feedback.js]"]
  node_accounts["Account balances<br/>[accounts.js]"]
end

subgraph group_records["Records and insights"]
  node_students["Student records<br/>[students.js]"]
  node_catalog["Courses and classes<br/>[courses.js]"]
  node_reports["Reports and performance<br/>[reports.js]"]
  node_database[("SQLite database<br/>[core.js]")]
end

subgraph group_system["System management"]
  node_configuration["System configuration<br/>[config-file.js]"]
  node_announcements["Announcements<br/>[announcements.js]"]
  node_audit["Audit and archives<br/>[audit.js]"]
  node_backups["Backup and restore<br/>[backups.js]"]
end

node_staff(("Staff"))
node_parents(("Parents"))

node_staff -->|"uses"| node_browser
node_parents -->|"opens link"| node_parentui
node_browser -->|"shows search"| node_public
node_browser -->|"shows admin"| node_adminui
node_public -->|"searches and queries"| node_clientapi
node_parentui -->|"requests access"| node_clientapi
node_adminui -->|"manages records"| node_clientapi
node_clientapi -->|"HTTP requests"| node_server
node_server -->|"dispatches routes"| node_api
node_api -->|"checks permissions"| node_auth
node_api -->|"reads and updates"| node_students
node_api -->|"reads and updates"| node_catalog
node_api -->|"creates and updates"| node_enrollment
node_api -->|"creates and queries"| node_schedule
node_api -->|"records attendance"| node_attendance
node_api -->|"manages feedback"| node_feedback
node_api -->|"builds reports"| node_reports
node_api -->|"manages announcements"| node_announcements
node_api -->|"records changes"| node_audit
node_api -->|"manages backups"| node_backups
node_enrollment -->|"adjusts balance"| node_accounts
node_students -->|"reads and writes"| node_database
node_catalog -->|"reads and writes"| node_database
node_enrollment -->|"reads and writes"| node_database
node_schedule -->|"reads and writes"| node_database
node_attendance -->|"records status"| node_database
node_feedback -->|"reads and writes"| node_database
node_accounts -->|"reads and writes"| node_database
node_reports -->|"queries data"| node_database
node_announcements -->|"reads and writes"| node_database
node_audit -->|"stores audit data"| node_database
node_backups -->|"backs up"| node_database
node_api -->|"reads and updates"| node_configuration
node_browser -->|"loads announcement"| node_announcements

click node_browser "https://github.com/mxlitey/pai-docker/blob/main/src/App.tsx"
click node_public "https://github.com/mxlitey/pai-docker/blob/main/src/components/Search/PublicSearch.tsx"
click node_parentui "https://github.com/mxlitey/pai-docker/blob/main/src/components/Parent/ParentH5.tsx"
click node_adminui "https://github.com/mxlitey/pai-docker/blob/main/src/components/Admin/AdminPanel.tsx"
click node_clientapi "https://github.com/mxlitey/pai-docker/blob/main/src/api/index.ts"
click node_server "https://github.com/mxlitey/pai-docker/blob/main/server.js"
click node_auth "https://github.com/mxlitey/pai-docker/blob/main/node-functions/_lib/auth.js"
click node_api "https://github.com/mxlitey/pai-docker/tree/main/node-functions/api"
click node_students "https://github.com/mxlitey/pai-docker/blob/main/node-functions/_lib/store/students.js"
click node_catalog "https://github.com/mxlitey/pai-docker/blob/main/node-functions/_lib/store/courses.js"
click node_enrollment "https://github.com/mxlitey/pai-docker/blob/main/node-functions/_lib/store/enrollments.js"
click node_schedule "https://github.com/mxlitey/pai-docker/blob/main/node-functions/_lib/store/schedules.js"
click node_attendance "https://github.com/mxlitey/pai-docker/blob/main/node-functions/api/attendance.js"
click node_feedback "https://github.com/mxlitey/pai-docker/blob/main/node-functions/_lib/store/feedback.js"
click node_accounts "https://github.com/mxlitey/pai-docker/blob/main/node-functions/_lib/store/accounts.js"
click node_reports "https://github.com/mxlitey/pai-docker/blob/main/node-functions/_lib/store/reports.js"
click node_database "https://github.com/mxlitey/pai-docker/blob/main/node-functions/_lib/store/core.js"
click node_configuration "https://github.com/mxlitey/pai-docker/blob/main/node-functions/_lib/config-file.js"
click node_announcements "https://github.com/mxlitey/pai-docker/blob/main/node-functions/_lib/store/announcements.js"
click node_audit "https://github.com/mxlitey/pai-docker/blob/main/node-functions/_lib/store/audit.js"
click node_backups "https://github.com/mxlitey/pai-docker/blob/main/node-functions/_lib/store/backups.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_browser,node_public,node_parentui,node_adminui,node_clientapi toneBlue
class node_server,node_auth,node_api toneAmber
class node_enrollment,node_schedule,node_attendance,node_feedback,node_accounts toneMint
class node_students,node_catalog,node_reports,node_database toneRose
class node_configuration,node_announcements,node_audit,node_backups,node_staff,node_parents toneIndigo
```

## Components

### Web application

- [React app](https://github.com/mxlitey/pai-docker/blob/main/src/App.tsx): `src/App.tsx`
- [Search and calendar](https://github.com/mxlitey/pai-docker/blob/main/src/components/Search/PublicSearch.tsx): `src/components/Search/PublicSearch.tsx`
- [Parent H5](https://github.com/mxlitey/pai-docker/blob/main/src/components/Parent/ParentH5.tsx): `src/components/Parent/ParentH5.tsx`
- [Admin workspace](https://github.com/mxlitey/pai-docker/blob/main/src/components/Admin/AdminPanel.tsx): `src/components/Admin/AdminPanel.tsx`
- [API client](https://github.com/mxlitey/pai-docker/blob/main/src/api/index.ts): `src/api/index.ts`

### HTTP and access

- [HTTP server](https://github.com/mxlitey/pai-docker/blob/main/server.js): `server.js`
- [Auth and RBAC](https://github.com/mxlitey/pai-docker/blob/main/node-functions/_lib/auth.js): `node-functions/_lib/auth.js`
- [API routes](https://github.com/mxlitey/pai-docker/tree/main/node-functions/api): `node-functions/api`

### Teaching operations

- [Enrollment and billing](https://github.com/mxlitey/pai-docker/blob/main/node-functions/_lib/store/enrollments.js): `node-functions/_lib/store/enrollments.js`
- [Scheduling and changes](https://github.com/mxlitey/pai-docker/blob/main/node-functions/_lib/store/schedules.js): `node-functions/_lib/store/schedules.js`
- [Attendance](https://github.com/mxlitey/pai-docker/blob/main/node-functions/api/attendance.js): `node-functions/api/attendance.js`
- [Teacher feedback](https://github.com/mxlitey/pai-docker/blob/main/node-functions/_lib/store/feedback.js): `node-functions/_lib/store/feedback.js`
- [Account balances](https://github.com/mxlitey/pai-docker/blob/main/node-functions/_lib/store/accounts.js): `node-functions/_lib/store/accounts.js`

### Records and insights

- [Student records](https://github.com/mxlitey/pai-docker/blob/main/node-functions/_lib/store/students.js): `node-functions/_lib/store/students.js`
- [Courses and classes](https://github.com/mxlitey/pai-docker/blob/main/node-functions/_lib/store/courses.js): `node-functions/_lib/store/courses.js`
- [Reports and performance](https://github.com/mxlitey/pai-docker/blob/main/node-functions/_lib/store/reports.js): `node-functions/_lib/store/reports.js`
- [SQLite database](https://github.com/mxlitey/pai-docker/blob/main/node-functions/_lib/store/core.js): `node-functions/_lib/store/core.js`

### System management

- [System configuration](https://github.com/mxlitey/pai-docker/blob/main/node-functions/_lib/config-file.js): `node-functions/_lib/config-file.js`
- [Announcements](https://github.com/mxlitey/pai-docker/blob/main/node-functions/_lib/store/announcements.js): `node-functions/_lib/store/announcements.js`
- [Audit and archives](https://github.com/mxlitey/pai-docker/blob/main/node-functions/_lib/store/audit.js): `node-functions/_lib/store/audit.js`
- [Backup and restore](https://github.com/mxlitey/pai-docker/blob/main/node-functions/_lib/store/backups.js): `node-functions/_lib/store/backups.js`

### Other components

- **Staff**
- **Parents**

## Connections

- Staff → React app: uses
- Parents → Parent H5: opens link
- React app → Search and calendar: shows search
- React app → Admin workspace: shows admin
- Search and calendar → API client: searches and queries
- Parent H5 → API client: requests access
- Admin workspace → API client: manages records
- API client → HTTP server: HTTP requests
- HTTP server → API routes: dispatches routes
- API routes → Auth and RBAC: checks permissions
- API routes → Student records: reads and updates
- API routes → Courses and classes: reads and updates
- API routes → Enrollment and billing: creates and updates
- API routes → Scheduling and changes: creates and queries
- API routes → Attendance: records attendance
- API routes → Teacher feedback: manages feedback
- API routes → Reports and performance: builds reports
- API routes → Announcements: manages announcements
- API routes → Audit and archives: records changes
- API routes → Backup and restore: manages backups
- Enrollment and billing → Account balances: adjusts balance
- Student records → SQLite database: reads and writes
- Courses and classes → SQLite database: reads and writes
- Enrollment and billing → SQLite database: reads and writes
- Scheduling and changes → SQLite database: reads and writes
- Attendance → SQLite database: records status
- Teacher feedback → SQLite database: reads and writes
- Account balances → SQLite database: reads and writes
- Reports and performance → SQLite database: queries data
- Announcements → SQLite database: reads and writes
- Audit and archives → SQLite database: stores audit data
- Backup and restore → SQLite database: backs up
- API routes → System configuration: reads and updates
- React app → Announcements: loads announcement
