# mcartv/smart-pdm architecture

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

- Interactive diagram: https://gitdiagram.com/mcartv/smart-pdm
- Repository: https://github.com/mcartv/smart-pdm

## Overview

SMaRT-PDM is a scholarship-management platform with administrative and partner portals, a student mobile application, separate APIs, and a Raspberry Pi OCR station. The principal workflow runs from student registration and application submission through staff review and endorsement, then scholar monitoring, renewals, Return of Obligations, payouts, and reporting. The graph preserves the documented product branches, while sampled code supports only selected application, messaging, and OCR relationships. Other links are omitted where the available excerpts do not establish the runtime connection.

Main entry points: [`admin/frontend/src`](https://github.com/mcartv/smart-pdm/tree/main/admin/frontend/src) (Admin portals), [`admin/backend/controllers/applicationController.js`](https://github.com/mcartv/smart-pdm/blob/main/admin/backend/controllers/applicationController.js) (Application review API), [`admin/backend/controllers/messageController.js`](https://github.com/mcartv/smart-pdm/blob/main/admin/backend/controllers/messageController.js) (Admin messaging), [`mobile/backend/src/server.js`](https://github.com/mcartv/smart-pdm/blob/main/mobile/backend/src/server.js) (Student API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_portals["User portals"]
  node_adminweb["Admin portals"]
  node_mobileapp["Student app"]
end

subgraph group_admin["Administrative API"]
  node_adminserver["Admin API server<br/>[server.js]"]
  node_approutes["Application routes"]
  node_appcontroller["Application review API"]
  node_appservice["Application processing"]
  node_messages["Admin messaging"]
  node_messagework["Message services<br/>[messageService.js]"]
  node_realtime["Realtime events<br/>[socketEvents.js]"]
  node_studentrelay["Student event relay"]
  node_ocrcontroller["OCR review API<br/>[ocrController.js]"]
  node_scholars["Scholar monitoring"]
  node_renewals["Renewals"]
  node_ro["RO compliance<br/>[roController.js]"]
  node_payouts["Payout management"]
  node_reports["Reporting<br/>[reportService.js]"]
end

subgraph group_student["Student API"]
  node_studentserver["Student API<br/>[server.js]"]
  node_studentapplication["Student applications"]
  node_studentmessages["Student messaging<br/>[messageService.js]"]
end

subgraph group_ocr["OCR station"]
  node_pi["Pi capture and OCR<br/>[main.py]"]
  node_ocrengine["OCR engine<br/>[ocr_engine.py]"]
end

subgraph group_platform["Shared platform"]
  node_database[("PostgreSQL<br/>[db.js]")]
  node_supabase[("Supabase storage<br/>[supabase.js]")]
end

node_students(("Students"))
node_staff(("OSFA and partners"))

node_students -->|"use"| node_mobileapp
node_staff -->|"use"| node_adminweb
node_adminweb -->|"request API"| node_adminserver
node_mobileapp -->|"request API"| node_studentserver
node_adminserver -->|"mount routes"| node_approutes
node_approutes -->|"route requests"| node_appcontroller
node_appcontroller -->|"delegate"| node_appservice
node_appcontroller -->|"emit updates"| node_realtime
node_appcontroller -->|"relay events"| node_studentrelay
node_messages -->|"delegate"| node_messagework
node_messages -->|"emit events"| node_realtime
node_messages -->|"relay events"| node_studentrelay
node_studentserver -.->|"serve requests"| node_studentapplication
node_studentserver -.->|"serve requests"| node_studentmessages
node_studentmessages -.->|"relay events"| node_messages
node_pi -.->|"process capture"| node_ocrengine
node_staff -->|"review OCR"| node_ocrcontroller
node_ocrcontroller -.->|"request capture"| node_pi
node_appservice -.->|"read and write"| node_database
node_studentapplication -.->|"read and write"| node_database
node_adminweb -->|"monitor scholars"| node_scholars
node_adminweb -->|"review renewals"| node_renewals
node_adminweb -->|"track compliance"| node_ro
node_adminweb -->|"manage payouts"| node_payouts
node_adminweb -->|"view reports"| node_reports
node_adminweb -->|"message users"| node_messages
node_adminweb -->|"review applications"| node_appcontroller
node_adminweb -->|"review scans"| node_ocrcontroller
node_supabase -.->|"store records"| node_studentapplication

click node_adminweb "https://github.com/mcartv/smart-pdm/tree/main/admin/frontend/src"
click node_mobileapp "https://github.com/mcartv/smart-pdm/tree/main/mobile/frontend"
click node_adminserver "https://github.com/mcartv/smart-pdm/blob/main/admin/backend/server/server.js"
click node_approutes "https://github.com/mcartv/smart-pdm/blob/main/admin/backend/routes/applicationRoutes.js"
click node_appcontroller "https://github.com/mcartv/smart-pdm/blob/main/admin/backend/controllers/applicationController.js"
click node_appservice "https://github.com/mcartv/smart-pdm/blob/main/admin/backend/services/applicationService.js"
click node_messages "https://github.com/mcartv/smart-pdm/blob/main/admin/backend/controllers/messageController.js"
click node_messagework "https://github.com/mcartv/smart-pdm/blob/main/admin/backend/services/messageService.js"
click node_realtime "https://github.com/mcartv/smart-pdm/blob/main/admin/backend/utils/socketEvents.js"
click node_studentrelay "https://github.com/mcartv/smart-pdm/blob/main/admin/backend/services/studentRealtimeRelayService.js"
click node_ocrcontroller "https://github.com/mcartv/smart-pdm/blob/main/admin/backend/controllers/ocrController.js"
click node_scholars "https://github.com/mcartv/smart-pdm/blob/main/admin/backend/controllers/scholarController.js"
click node_renewals "https://github.com/mcartv/smart-pdm/blob/main/admin/backend/controllers/renewalController.js"
click node_ro "https://github.com/mcartv/smart-pdm/blob/main/admin/backend/controllers/roController.js"
click node_payouts "https://github.com/mcartv/smart-pdm/blob/main/admin/backend/controllers/payoutController.js"
click node_reports "https://github.com/mcartv/smart-pdm/blob/main/admin/backend/services/reportService.js"
click node_studentserver "https://github.com/mcartv/smart-pdm/blob/main/mobile/backend/src/server.js"
click node_studentapplication "https://github.com/mcartv/smart-pdm/blob/main/mobile/backend/src/services/applicationService.js"
click node_studentmessages "https://github.com/mcartv/smart-pdm/blob/main/mobile/backend/src/services/messageService.js"
click node_pi "https://github.com/mcartv/smart-pdm/blob/main/ocr/scanner/main.py"
click node_ocrengine "https://github.com/mcartv/smart-pdm/blob/main/ocr/scanner/extraction/ocr_engine.py"
click node_database "https://github.com/mcartv/smart-pdm/blob/main/admin/backend/config/db.js"
click node_supabase "https://github.com/mcartv/smart-pdm/blob/main/mobile/backend/src/config/supabase.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_adminweb,node_mobileapp toneBlue
class node_adminserver,node_approutes,node_appcontroller,node_appservice,node_messages,node_messagework,node_realtime,node_studentrelay,node_ocrcontroller,node_scholars,node_renewals,node_ro,node_payouts,node_reports toneAmber
class node_studentserver,node_studentapplication,node_studentmessages toneMint
class node_pi,node_ocrengine toneRose
class node_database,node_supabase,node_students,node_staff toneIndigo
```

## Components

### User portals

- [Admin portals](https://github.com/mcartv/smart-pdm/tree/main/admin/frontend/src): `admin/frontend/src`
- [Student app](https://github.com/mcartv/smart-pdm/tree/main/mobile/frontend): `mobile/frontend`

### Administrative API

- [Admin API server](https://github.com/mcartv/smart-pdm/blob/main/admin/backend/server/server.js): `admin/backend/server/server.js`
- [Application routes](https://github.com/mcartv/smart-pdm/blob/main/admin/backend/routes/applicationRoutes.js): `admin/backend/routes/applicationRoutes.js`
- [Application review API](https://github.com/mcartv/smart-pdm/blob/main/admin/backend/controllers/applicationController.js): `admin/backend/controllers/applicationController.js`
- [Application processing](https://github.com/mcartv/smart-pdm/blob/main/admin/backend/services/applicationService.js): `admin/backend/services/applicationService.js`
- [Admin messaging](https://github.com/mcartv/smart-pdm/blob/main/admin/backend/controllers/messageController.js): `admin/backend/controllers/messageController.js`
- [Message services](https://github.com/mcartv/smart-pdm/blob/main/admin/backend/services/messageService.js): `admin/backend/services/messageService.js`
- [Realtime events](https://github.com/mcartv/smart-pdm/blob/main/admin/backend/utils/socketEvents.js): `admin/backend/utils/socketEvents.js`
- [Student event relay](https://github.com/mcartv/smart-pdm/blob/main/admin/backend/services/studentRealtimeRelayService.js): `admin/backend/services/studentRealtimeRelayService.js`
- [OCR review API](https://github.com/mcartv/smart-pdm/blob/main/admin/backend/controllers/ocrController.js): `admin/backend/controllers/ocrController.js`
- [Scholar monitoring](https://github.com/mcartv/smart-pdm/blob/main/admin/backend/controllers/scholarController.js): `admin/backend/controllers/scholarController.js`
- [Renewals](https://github.com/mcartv/smart-pdm/blob/main/admin/backend/controllers/renewalController.js): `admin/backend/controllers/renewalController.js`
- [RO compliance](https://github.com/mcartv/smart-pdm/blob/main/admin/backend/controllers/roController.js): `admin/backend/controllers/roController.js`
- [Payout management](https://github.com/mcartv/smart-pdm/blob/main/admin/backend/controllers/payoutController.js): `admin/backend/controllers/payoutController.js`
- [Reporting](https://github.com/mcartv/smart-pdm/blob/main/admin/backend/services/reportService.js): `admin/backend/services/reportService.js`

### Student API

- [Student API](https://github.com/mcartv/smart-pdm/blob/main/mobile/backend/src/server.js): `mobile/backend/src/server.js`
- [Student applications](https://github.com/mcartv/smart-pdm/blob/main/mobile/backend/src/services/applicationService.js): `mobile/backend/src/services/applicationService.js`
- [Student messaging](https://github.com/mcartv/smart-pdm/blob/main/mobile/backend/src/services/messageService.js): `mobile/backend/src/services/messageService.js`

### OCR station

- [Pi capture and OCR](https://github.com/mcartv/smart-pdm/blob/main/ocr/scanner/main.py): `ocr/scanner/main.py`
- [OCR engine](https://github.com/mcartv/smart-pdm/blob/main/ocr/scanner/extraction/ocr_engine.py): `ocr/scanner/extraction/ocr_engine.py`

### Shared platform

- [PostgreSQL](https://github.com/mcartv/smart-pdm/blob/main/admin/backend/config/db.js): `admin/backend/config/db.js`
- [Supabase storage](https://github.com/mcartv/smart-pdm/blob/main/mobile/backend/src/config/supabase.js): `mobile/backend/src/config/supabase.js`

### Other components

- **Students**
- **OSFA and partners**

## Connections

- Students → Student app: use (evidence: `README.md`)
- OSFA and partners → Admin portals: use (evidence: `README.md`)
- Admin portals → Admin API server: request API (evidence: `README.md`)
- Student app → Student API: request API (evidence: `README.md`)
- Admin API server → Application routes: mount routes (evidence: `admin/backend/server/server.js`)
- Application routes → Application review API: route requests (evidence: `admin/backend/routes/applicationRoutes.js`)
- Application review API → Application processing: delegate (evidence: `admin/backend/controllers/applicationController.js`)
- Application review API → Realtime events: emit updates (evidence: `admin/backend/controllers/applicationController.js`)
- Application review API → Student event relay: relay events (evidence: `admin/backend/controllers/applicationController.js`)
- Admin messaging → Message services: delegate (evidence: `admin/backend/controllers/messageController.js`)
- Admin messaging → Realtime events: emit events (evidence: `admin/backend/controllers/messageController.js`)
- Admin messaging → Student event relay: relay events (evidence: `admin/backend/controllers/messageController.js`)
- Student API → Student applications: serve requests
- Student API → Student messaging: serve requests
- Student messaging → Admin messaging: relay events
- Pi capture and OCR → OCR engine: process capture
- OSFA and partners → OCR review API: review OCR (evidence: `README.md`)
- OCR review API → Pi capture and OCR: request capture
- Application processing → PostgreSQL: read and write
- Student applications → PostgreSQL: read and write
- Admin portals → Scholar monitoring: monitor scholars (evidence: `README.md`)
- Admin portals → Renewals: review renewals (evidence: `README.md`)
- Admin portals → RO compliance: track compliance (evidence: `README.md`)
- Admin portals → Payout management: manage payouts (evidence: `README.md`)
- Admin portals → Reporting: view reports (evidence: `README.md`)
- Admin portals → Admin messaging: message users (evidence: `README.md`)
- Admin portals → Application review API: review applications (evidence: `README.md`)
- Admin portals → OCR review API: review scans (evidence: `README.md`)
- Supabase storage → Student applications: store records
