# miguel92245/ekuikui-lab-control architecture

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

- Interactive diagram: https://gitdiagram.com/miguel92245/ekuikui-lab-control
- Repository: https://github.com/miguel92245/ekuikui-lab-control

## Overview

This is a web system for managing professors, course constraints and institutional resources, then generating practical-class laboratory allocations and reporting conflicts. The main workflow runs from a secretary or professor using the web interface, through backend routes and controllers, to scheduling logic and MySQL; the secretary can preview or persist allocations and inspect results. The graph preserves the documented authentication, professor submissions, resource management and allocation capabilities. Frontend-to-API connections are shown as unverified because the sampled frontend excerpts do not expose their requests.

Main entry points: [`backend/server.js`](https://github.com/miguel92245/ekuikui-lab-control/blob/main/backend/server.js) (HTTP server), [`js/api.js`](https://github.com/miguel92245/ekuikui-lab-control/blob/main/js/api.js) (API client), [`backend/config/database.js`](https://github.com/miguel92245/ekuikui-lab-control/blob/main/backend/config/database.js) (MySQL connection), [`backend/routes/professorRoutes.js`](https://github.com/miguel92245/ekuikui-lab-control/blob/main/backend/routes/professorRoutes.js) (Professor routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web interface"]
  node_professor_ui["Professor portal<br/>[professor.html]"]
  node_secretary_ui["Secretariat portal<br/>[secretaria.html]"]
  node_login_ui["Login interface<br/>[index.html]"]
  node_api_client["API client<br/>[api.js]"]
  node_login_logic["Login workflow<br/>[login.js]"]
  node_professor_logic["Professor workflow<br/>[professor.js]"]
  node_secretary_logic["Secretary workflow<br/>[secretaria.js]"]
end

subgraph group_api["Backend API"]
  node_server["HTTP server<br/>[server.js]"]
  node_auth_routes["Authentication routes<br/>[authRoutes.js]"]
  node_auth_controller["Login handler<br/>[authController.js]"]
  node_prof_routes["Professor routes<br/>[professorRoutes.js]"]
  node_auth_middleware["Token validation<br/>[authMiddleware.js]"]
  node_prof_controller["Professor services"]
end

subgraph group_schedule["Allocation"]
  node_allocation_controller["Allocation handler"]
  node_allocation_algorithm["Allocation algorithm"]
end

subgraph group_data["Persistence"]
  node_user_model["User records<br/>[User.js]"]
  node_professor_model["Professor records<br/>[Professor.js]"]
  node_models["Scheduling and resource models"]
  node_database[("MySQL connection<br/>[database.js]")]
  node_sql_schema["Database schema"]
end

node_professor(("Professor"))
node_secretary(("Secretariat"))

node_professor -.->|"uses"| node_professor_ui
node_secretary -.->|"uses"| node_secretary_ui
node_professor_ui -.->|"runs"| node_professor_logic
node_secretary_ui -.->|"runs"| node_secretary_logic
node_login_ui -.->|"runs"| node_login_logic
node_login_logic -.->|"uses"| node_api_client
node_professor_logic -.->|"uses"| node_api_client
node_secretary_logic -.->|"uses"| node_api_client
node_api_client -.->|"requests"| node_server
node_server -->|"mounts"| node_auth_routes
node_server -->|"mounts"| node_prof_routes
node_auth_routes -->|"dispatches"| node_auth_controller
node_auth_controller -->|"looks up"| node_user_model
node_prof_routes -->|"validates with"| node_auth_middleware
node_prof_routes -->|"dispatches"| node_prof_controller
node_prof_controller -->|"reads and writes"| node_models
node_server -->|"dispatches"| node_allocation_controller
node_allocation_controller -->|"generates with"| node_allocation_algorithm
node_allocation_controller -->|"persists and reads"| node_database
node_allocation_algorithm -->|"reads"| node_database
node_professor_model -->|"queries"| node_database
node_models -.->|"queries"| node_database
node_server -->|"manages"| node_professor_model

click node_professor_ui "https://github.com/miguel92245/ekuikui-lab-control/blob/main/professor.html"
click node_secretary_ui "https://github.com/miguel92245/ekuikui-lab-control/blob/main/secretaria.html"
click node_login_ui "https://github.com/miguel92245/ekuikui-lab-control/blob/main/index.html"
click node_api_client "https://github.com/miguel92245/ekuikui-lab-control/blob/main/js/api.js"
click node_login_logic "https://github.com/miguel92245/ekuikui-lab-control/blob/main/js/login.js"
click node_professor_logic "https://github.com/miguel92245/ekuikui-lab-control/blob/main/js/professor.js"
click node_secretary_logic "https://github.com/miguel92245/ekuikui-lab-control/blob/main/js/secretaria.js"
click node_server "https://github.com/miguel92245/ekuikui-lab-control/blob/main/backend/server.js"
click node_auth_routes "https://github.com/miguel92245/ekuikui-lab-control/blob/main/backend/routes/authRoutes.js"
click node_auth_controller "https://github.com/miguel92245/ekuikui-lab-control/blob/main/backend/controllers/authController.js"
click node_user_model "https://github.com/miguel92245/ekuikui-lab-control/blob/main/backend/models/User.js"
click node_prof_routes "https://github.com/miguel92245/ekuikui-lab-control/blob/main/backend/routes/professorRoutes.js"
click node_auth_middleware "https://github.com/miguel92245/ekuikui-lab-control/blob/main/backend/middleware/authMiddleware.js"
click node_prof_controller "https://github.com/miguel92245/ekuikui-lab-control/blob/main/backend/controllers/professorController.js"
click node_professor_model "https://github.com/miguel92245/ekuikui-lab-control/blob/main/backend/models/Professor.js"
click node_allocation_controller "https://github.com/miguel92245/ekuikui-lab-control/blob/main/backend/controllers/alocacaoController.js"
click node_allocation_algorithm "https://github.com/miguel92245/ekuikui-lab-control/blob/main/backend/utils/alocacaoAlgorithm.js"
click node_models "https://github.com/miguel92245/ekuikui-lab-control/tree/main/backend/models"
click node_database "https://github.com/miguel92245/ekuikui-lab-control/blob/main/backend/config/database.js"
click node_sql_schema "https://github.com/miguel92245/ekuikui-lab-control/blob/main/database/ekuikui_lab_sql.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_professor_ui,node_secretary_ui,node_login_ui,node_api_client,node_login_logic,node_professor_logic,node_secretary_logic toneBlue
class node_server,node_auth_routes,node_auth_controller,node_prof_routes,node_auth_middleware,node_prof_controller toneAmber
class node_allocation_controller,node_allocation_algorithm toneMint
class node_user_model,node_professor_model,node_models,node_database,node_sql_schema toneRose
class node_professor,node_secretary toneIndigo
```

## Components

### Web interface

- [Professor portal](https://github.com/miguel92245/ekuikui-lab-control/blob/main/professor.html): `professor.html`
- [Secretariat portal](https://github.com/miguel92245/ekuikui-lab-control/blob/main/secretaria.html): `secretaria.html`
- [Login interface](https://github.com/miguel92245/ekuikui-lab-control/blob/main/index.html): `index.html`
- [API client](https://github.com/miguel92245/ekuikui-lab-control/blob/main/js/api.js): `js/api.js`
- [Login workflow](https://github.com/miguel92245/ekuikui-lab-control/blob/main/js/login.js): `js/login.js`
- [Professor workflow](https://github.com/miguel92245/ekuikui-lab-control/blob/main/js/professor.js): `js/professor.js`
- [Secretary workflow](https://github.com/miguel92245/ekuikui-lab-control/blob/main/js/secretaria.js): `js/secretaria.js`

### Backend API

- [HTTP server](https://github.com/miguel92245/ekuikui-lab-control/blob/main/backend/server.js): `backend/server.js`
- [Authentication routes](https://github.com/miguel92245/ekuikui-lab-control/blob/main/backend/routes/authRoutes.js): `backend/routes/authRoutes.js`
- [Login handler](https://github.com/miguel92245/ekuikui-lab-control/blob/main/backend/controllers/authController.js): `backend/controllers/authController.js`
- [Professor routes](https://github.com/miguel92245/ekuikui-lab-control/blob/main/backend/routes/professorRoutes.js): `backend/routes/professorRoutes.js`
- [Token validation](https://github.com/miguel92245/ekuikui-lab-control/blob/main/backend/middleware/authMiddleware.js): `backend/middleware/authMiddleware.js`
- [Professor services](https://github.com/miguel92245/ekuikui-lab-control/blob/main/backend/controllers/professorController.js): `backend/controllers/professorController.js`

### Allocation

- [Allocation handler](https://github.com/miguel92245/ekuikui-lab-control/blob/main/backend/controllers/alocacaoController.js): `backend/controllers/alocacaoController.js`
- [Allocation algorithm](https://github.com/miguel92245/ekuikui-lab-control/blob/main/backend/utils/alocacaoAlgorithm.js): `backend/utils/alocacaoAlgorithm.js`

### Persistence

- [User records](https://github.com/miguel92245/ekuikui-lab-control/blob/main/backend/models/User.js): `backend/models/User.js`
- [Professor records](https://github.com/miguel92245/ekuikui-lab-control/blob/main/backend/models/Professor.js): `backend/models/Professor.js`
- [Scheduling and resource models](https://github.com/miguel92245/ekuikui-lab-control/tree/main/backend/models): `backend/models`
- [MySQL connection](https://github.com/miguel92245/ekuikui-lab-control/blob/main/backend/config/database.js): `backend/config/database.js`
- [Database schema](https://github.com/miguel92245/ekuikui-lab-control/blob/main/database/ekuikui_lab_sql.sql): `database/ekuikui_lab_sql.sql`

### Other components

- **Professor**
- **Secretariat**

## Connections

- Professor → Professor portal: uses
- Secretariat → Secretariat portal: uses
- Professor portal → Professor workflow: runs
- Secretariat portal → Secretary workflow: runs
- Login interface → Login workflow: runs
- Login workflow → API client: uses
- Professor workflow → API client: uses
- Secretary workflow → API client: uses
- API client → HTTP server: requests
- HTTP server → Authentication routes: mounts (evidence: `backend/server.js`)
- HTTP server → Professor routes: mounts (evidence: `backend/server.js`)
- Authentication routes → Login handler: dispatches (evidence: `backend/routes/authRoutes.js`)
- Login handler → User records: looks up (evidence: `backend/controllers/authController.js`)
- Professor routes → Token validation: validates with (evidence: `backend/routes/professorRoutes.js`)
- Professor routes → Professor services: dispatches (evidence: `backend/routes/professorRoutes.js`)
- Professor services → Scheduling and resource models: reads and writes (evidence: `backend/controllers/professorController.js`)
- HTTP server → Allocation handler: dispatches (evidence: `backend/server.js`)
- Allocation handler → Allocation algorithm: generates with (evidence: `backend/controllers/alocacaoController.js`)
- Allocation handler → MySQL connection: persists and reads (evidence: `backend/controllers/alocacaoController.js`)
- Allocation algorithm → MySQL connection: reads (evidence: `backend/utils/alocacaoAlgorithm.js`)
- Professor records → MySQL connection: queries (evidence: `backend/models/Professor.js`)
- Scheduling and resource models → MySQL connection: queries (evidence: `backend/models/Professor.js`)
- HTTP server → Professor records: manages (evidence: `backend/server.js`)
