# projetointegradorumc/projeto-integrador architecture

> Architecture diagram of the GitHub repository projetointegradorumc/projeto-integrador, 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/projetointegradorumc/projeto-integrador
- Repository: https://github.com/projetointegradorumc/projeto-integrador

## Overview

Mentory connects students seeking help with student tutors, while the current implemented foundation emphasizes authentication and security. The main user flow runs from the browser through Flask routes to persistent account, session, tutoring, and audit data; distinct branches cover password recovery, 2FA, tutoring enrollment, LGPD rights, and administrator auditing. Evidence is limited to the README and sampled/indexed files, so undocumented links—especially audit-log production and immutable-log enforcement—are not inferred.

Main entry points: [`backend/app/routes/auth.py`](https://github.com/projetointegradorumc/projeto-integrador/blob/main/backend/app/routes/auth.py) (Authentication), [`backend/app/models.py`](https://github.com/projetointegradorumc/projeto-integrador/blob/main/backend/app/models.py) (Domain and audit models), [`backend/app/__init__.py`](https://github.com/projetointegradorumc/projeto-integrador/blob/main/backend/app/__init__.py) (Flask application), [`backend/app/utils/sessions.py`](https://github.com/projetointegradorumc/projeto-integrador/blob/main/backend/app/utils/sessions.py) (Session management)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Student interface"]
  node_browser["Web interface<br/>[app.js]"]
end

subgraph group_security["Identity and security"]
  node_app["Flask application<br/>[__init__.py]"]
  node_auth["Authentication<br/>[auth.py]"]
  node_sessions["Session management<br/>[sessions.py]"]
  node_twofactor["TOTP security<br/>[two_factor.py]"]
  node_recovery["Password recovery email<br/>[email.py]"]
end

subgraph group_domain["Tutoring and privacy"]
  node_tutoring["Tutoring offers<br/>[tutoring_offers.py]"]
  node_privacy["LGPD data rights<br/>[lgpd.py]"]
end

subgraph group_operations["Audit and persistence"]
  node_admin["Audit dashboard<br/>[admin.py]"]
  node_models["Domain and audit models<br/>[models.py]"]
  node_postgres[("PostgreSQL")]
end

node_student(("Student"))
node_smtp["SMTP service"]

node_student -->|"uses"| node_browser
node_browser -->|"requests auth"| node_auth
node_browser -->|"requests offers"| node_tutoring
node_browser -->|"requests export"| node_privacy
node_app -->|"registers routes"| node_auth
node_app -->|"registers routes"| node_tutoring
node_app -->|"registers routes"| node_privacy
node_app -->|"registers routes"| node_admin
node_auth -->|"uses sessions"| node_sessions
node_tutoring -->|"guards routes"| node_sessions
node_privacy -->|"guards routes"| node_sessions
node_admin -->|"guards routes"| node_sessions
node_auth -->|"validates TOTP"| node_twofactor
node_models -->|"encrypts secrets"| node_twofactor
node_auth -->|"sends recovery mail"| node_recovery
node_recovery -->|"sends email"| node_smtp
node_auth -->|"reads and writes"| node_models
node_tutoring -->|"reads and writes"| node_models
node_privacy -->|"exports and deletes"| node_models
node_admin -->|"queries audit logs"| node_models
node_sessions -->|"persists sessions"| node_models
node_app -->|"configures ORM"| node_postgres

click node_browser "https://github.com/projetointegradorumc/projeto-integrador/blob/main/frontend/js/app.js"
click node_app "https://github.com/projetointegradorumc/projeto-integrador/blob/main/backend/app/__init__.py"
click node_auth "https://github.com/projetointegradorumc/projeto-integrador/blob/main/backend/app/routes/auth.py"
click node_sessions "https://github.com/projetointegradorumc/projeto-integrador/blob/main/backend/app/utils/sessions.py"
click node_twofactor "https://github.com/projetointegradorumc/projeto-integrador/blob/main/backend/app/two_factor.py"
click node_recovery "https://github.com/projetointegradorumc/projeto-integrador/blob/main/backend/app/utils/email.py"
click node_tutoring "https://github.com/projetointegradorumc/projeto-integrador/blob/main/backend/app/routes/tutoring_offers.py"
click node_privacy "https://github.com/projetointegradorumc/projeto-integrador/blob/main/backend/app/routes/lgpd.py"
click node_admin "https://github.com/projetointegradorumc/projeto-integrador/blob/main/backend/app/routes/admin.py"
click node_models "https://github.com/projetointegradorumc/projeto-integrador/blob/main/backend/app/models.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_browser toneBlue
class node_app,node_auth,node_sessions,node_twofactor,node_recovery toneAmber
class node_tutoring,node_privacy toneMint
class node_admin,node_models,node_postgres toneRose
class node_student,node_smtp toneIndigo
```

## Components

### Student interface

- [Web interface](https://github.com/projetointegradorumc/projeto-integrador/blob/main/frontend/js/app.js): `frontend/js/app.js`

### Identity and security

- [Flask application](https://github.com/projetointegradorumc/projeto-integrador/blob/main/backend/app/__init__.py): `backend/app/__init__.py`
- [Authentication](https://github.com/projetointegradorumc/projeto-integrador/blob/main/backend/app/routes/auth.py): `backend/app/routes/auth.py`
- [Session management](https://github.com/projetointegradorumc/projeto-integrador/blob/main/backend/app/utils/sessions.py): `backend/app/utils/sessions.py`
- [TOTP security](https://github.com/projetointegradorumc/projeto-integrador/blob/main/backend/app/two_factor.py): `backend/app/two_factor.py`
- [Password recovery email](https://github.com/projetointegradorumc/projeto-integrador/blob/main/backend/app/utils/email.py): `backend/app/utils/email.py`

### Tutoring and privacy

- [Tutoring offers](https://github.com/projetointegradorumc/projeto-integrador/blob/main/backend/app/routes/tutoring_offers.py): `backend/app/routes/tutoring_offers.py`
- [LGPD data rights](https://github.com/projetointegradorumc/projeto-integrador/blob/main/backend/app/routes/lgpd.py): `backend/app/routes/lgpd.py`

### Audit and persistence

- [Audit dashboard](https://github.com/projetointegradorumc/projeto-integrador/blob/main/backend/app/routes/admin.py): `backend/app/routes/admin.py`
- [Domain and audit models](https://github.com/projetointegradorumc/projeto-integrador/blob/main/backend/app/models.py): `backend/app/models.py`
- **PostgreSQL**

### Other components

- **Student**
- **SMTP service**

## Connections

- Student → Web interface: uses (evidence: `README.md`)
- Web interface → Authentication: requests auth (evidence: `frontend/js/app.js`)
- Web interface → Tutoring offers: requests offers (evidence: `frontend/js/app.js`)
- Web interface → LGPD data rights: requests export (evidence: `frontend/js/app.js`)
- Flask application → Authentication: registers routes (evidence: `backend/app/__init__.py`)
- Flask application → Tutoring offers: registers routes (evidence: `backend/app/__init__.py`)
- Flask application → LGPD data rights: registers routes (evidence: `backend/app/__init__.py`)
- Flask application → Audit dashboard: registers routes (evidence: `backend/app/__init__.py`)
- Authentication → Session management: uses sessions (evidence: `backend/app/routes/auth.py`)
- Tutoring offers → Session management: guards routes (evidence: `backend/app/routes/tutoring_offers.py`)
- LGPD data rights → Session management: guards routes (evidence: `backend/app/routes/lgpd.py`)
- Audit dashboard → Session management: guards routes (evidence: `backend/app/routes/admin.py`)
- Authentication → TOTP security: validates TOTP (evidence: `backend/app/routes/auth.py`)
- Domain and audit models → TOTP security: encrypts secrets (evidence: `backend/app/models.py`)
- Authentication → Password recovery email: sends recovery mail (evidence: `backend/app/routes/auth.py`)
- Password recovery email → SMTP service: sends email (evidence: `backend/app/utils/email.py`)
- Authentication → Domain and audit models: reads and writes (evidence: `backend/app/routes/auth.py`)
- Tutoring offers → Domain and audit models: reads and writes (evidence: `backend/app/routes/tutoring_offers.py`)
- LGPD data rights → Domain and audit models: exports and deletes (evidence: `backend/app/routes/lgpd.py`)
- Audit dashboard → Domain and audit models: queries audit logs (evidence: `backend/app/routes/admin.py`)
- Session management → Domain and audit models: persists sessions (evidence: `backend/app/utils/sessions.py`)
- Flask application → PostgreSQL: configures ORM (evidence: `backend/app/__init__.py`)
