# myeniamahle/studentreach architecture

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

- Interactive diagram: https://gitdiagram.com/myeniamahle/studentreach
- Repository: https://github.com/myeniamahle/studentreach
- Video tour (about a minute): https://gitdiagram.com/myeniamahle/studentreach/video

## Overview

StudentReach is a backend API for viewing student profiles, identifying risk signals, and managing resulting advisor flags. The main workflow loads student histories, evaluates attendance, assignment, funding, and engagement rules, combines recent signals, and persists flags; API clients can then review flags and record decisions. The sampled frontend and login files are explicitly examples that are not connected or functional, so they are excluded. The schema path is documented, but its table definitions were not sampled.

Main entry points: [`backend/src/server.js`](https://github.com/myeniamahle/studentreach/blob/main/backend/src/server.js) (Express API), [`backend/src/runDetection.js`](https://github.com/myeniamahle/studentreach/blob/main/backend/src/runDetection.js) (Detection runner), [`backend/src/db.js`](https://github.com/myeniamahle/studentreach/blob/main/backend/src/db.js) (PostgreSQL pool), [`backend/src/repository.js`](https://github.com/myeniamahle/studentreach/blob/main/backend/src/repository.js) (Student repository)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API"]
  node_server["Express API<br/>[server.js]"]
  node_student_routes["Student routes<br/>[server.js]"]
  node_detection_route["Detection route<br/>[server.js]"]
end

subgraph group_data["Student Data"]
  node_repository["Student repository<br/>[repository.js]"]
  node_pool["PostgreSQL pool<br/>[db.js]"]
  node_database[("StudentReach database<br/>[schema.sql]")]
end

subgraph group_detection["Risk Detection"]
  node_rules["Risk rules<br/>[detection.js]"]
  node_orchestrator["Detection runner<br/>[runDetection.js]"]
end

subgraph group_review["Flag Review"]
  node_flag_routes["Flag routes<br/>[server.js]"]
end

node_client(("API client"))

node_client -->|"requests API"| node_server
node_server -->|"dispatches"| node_student_routes
node_server -->|"dispatches"| node_flag_routes
node_server -->|"dispatches"| node_detection_route
node_student_routes -->|"loads students"| node_repository
node_repository -->|"queries histories"| node_pool
node_pool -->|"reads and writes"| node_database
node_flag_routes -->|"queries and updates"| node_pool
node_detection_route -->|"runs detection"| node_orchestrator
node_orchestrator -->|"loads students"| node_repository
node_orchestrator -->|"evaluates students"| node_rules
node_orchestrator -->|"persists flags"| node_pool

click node_server "https://github.com/myeniamahle/studentreach/blob/main/backend/src/server.js"
click node_student_routes "https://github.com/myeniamahle/studentreach/blob/main/backend/src/server.js"
click node_flag_routes "https://github.com/myeniamahle/studentreach/blob/main/backend/src/server.js"
click node_detection_route "https://github.com/myeniamahle/studentreach/blob/main/backend/src/server.js"
click node_repository "https://github.com/myeniamahle/studentreach/blob/main/backend/src/repository.js"
click node_rules "https://github.com/myeniamahle/studentreach/blob/main/backend/src/detection.js"
click node_orchestrator "https://github.com/myeniamahle/studentreach/blob/main/backend/src/runDetection.js"
click node_pool "https://github.com/myeniamahle/studentreach/blob/main/backend/src/db.js"
click node_database "https://github.com/myeniamahle/studentreach/blob/main/backend/sql/schema.sql"

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_server,node_student_routes,node_detection_route,node_client toneBlue
class node_repository,node_pool,node_database toneAmber
class node_rules,node_orchestrator toneMint
class node_flag_routes toneRose
```

## Components

### API

- [Express API](https://github.com/myeniamahle/studentreach/blob/main/backend/src/server.js): `backend/src/server.js`
- [Student routes](https://github.com/myeniamahle/studentreach/blob/main/backend/src/server.js): `backend/src/server.js`
- [Detection route](https://github.com/myeniamahle/studentreach/blob/main/backend/src/server.js): `backend/src/server.js`

### Student Data

- [Student repository](https://github.com/myeniamahle/studentreach/blob/main/backend/src/repository.js): `backend/src/repository.js`
- [PostgreSQL pool](https://github.com/myeniamahle/studentreach/blob/main/backend/src/db.js): `backend/src/db.js`
- [StudentReach database](https://github.com/myeniamahle/studentreach/blob/main/backend/sql/schema.sql): `backend/sql/schema.sql`

### Risk Detection

- [Risk rules](https://github.com/myeniamahle/studentreach/blob/main/backend/src/detection.js): `backend/src/detection.js`
- [Detection runner](https://github.com/myeniamahle/studentreach/blob/main/backend/src/runDetection.js): `backend/src/runDetection.js`

### Flag Review

- [Flag routes](https://github.com/myeniamahle/studentreach/blob/main/backend/src/server.js): `backend/src/server.js`

### Other components

- **API client**

## Connections

- API client → Express API: requests API
- Express API → Student routes: dispatches
- Express API → Flag routes: dispatches
- Express API → Detection route: dispatches
- Student routes → Student repository: loads students
- Student repository → PostgreSQL pool: queries histories
- PostgreSQL pool → StudentReach database: reads and writes
- Flag routes → PostgreSQL pool: queries and updates
- Detection route → Detection runner: runs detection
- Detection runner → Student repository: loads students
- Detection runner → Risk rules: evaluates students
- Detection runner → PostgreSQL pool: persists flags
