# isaactxr/rpvp architecture

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

- Interactive diagram: https://gitdiagram.com/isaactxr/rpvp
- Repository: https://github.com/isaactxr/rpvp

## Overview

Laboral is a web system for facially verified attendance, session operations, and administrative audit. Users sign in, access role-gated modules, and can check in/out through a blink-validated facial capture; administrators and instructors manage sessions, while authorized staff review attendance and audit exports. The backend separates HTTP routing/controllers from domain services and PostgreSQL; a separate recognition service evaluates submitted images. The README documents the frontend capabilities, but sampled frontend excerpts do not show its API calls, so those links are marked unverified.

Main entry points: [`backend/src/controllers/reconhecerController.js`](https://github.com/isaactxr/rpvp/blob/main/backend/src/controllers/reconhecerController.js) (Domain handlers), [`frontend/scripts`](https://github.com/isaactxr/rpvp/tree/main/frontend/scripts) (Browser modules), [`backend/src/config/database.js`](https://github.com/isaactxr/rpvp/blob/main/backend/src/config/database.js) (PostgreSQL), [`backend/src/routes/reconhecer.js`](https://github.com/isaactxr/rpvp/blob/main/backend/src/routes/reconhecer.js) (HTTP routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web interface"]
  node_web["Browser modules"]
  node_login["Login and password<br/>[login.js]"]
  node_sessionsui["Session management<br/>[sessoes.js]"]
  node_sessionui["Session detail<br/>[sessao.js]"]
  node_auditui["Attendance audit<br/>[registros.js]"]
  node_dashboard["Operations dashboard<br/>[dashboard.js]"]
  node_usersui["User administration<br/>[usuarios.js]"]
  node_settingsui["System settings<br/>[configuracoes.js]"]
end

subgraph group_http["HTTP and access"]
  node_api["HTTP routes<br/>[reconhecer.js]"]
  node_authmw["Auth and roles<br/>[auth.js]"]
  node_controller["Domain handlers"]
end

subgraph group_attendance["Attendance operations"]
  node_recognition["Face recognition client"]
  node_faceengine["Recognition engine<br/>[app.py]"]
  node_faceusers["Face collections"]
  node_presence["Presence records<br/>[presencaService.js]"]
  node_sessions["Session lifecycle<br/>[sessaoService.js]"]
  node_audit["Audit queries"]
  node_auditexport["Audit exports"]
  node_sessionexport["Session exports"]
end

subgraph group_admin["Administration"]
  node_users["User management<br/>[usuarioService.js]"]
  node_userio["User import/export"]
  node_auth["Authentication service<br/>[authService.js]"]
  node_crypto["Password cryptography<br/>[cryptoService.js]"]
  node_configcontroller["Admin handlers<br/>[adminController.js]"]
  node_config["Runtime configuration<br/>[configService.js]"]
  node_types["Session types"]
end

subgraph group_platform["Runtime and persistence"]
  node_database[("PostgreSQL<br/>[database.js]")]
  node_server["Express application<br/>[server.js]"]
end

node_person(("Staff and admins"))

node_person -->|"uses"| node_web
node_web -.->|"calls API"| node_api
node_api -->|"authenticates"| node_authmw
node_api -->|"dispatches"| node_controller
node_authmw -->|"validates session"| node_auth
node_controller -->|"requests match"| node_recognition
node_controller -->|"loads candidates"| node_faceusers
node_controller -->|"records attendance"| node_presence
node_controller -->|"handles sessions"| node_sessions
node_controller -->|"queries audit"| node_audit
node_controller -->|"exports audit"| node_auditexport
node_controller -->|"exports sessions"| node_sessionexport
node_controller -->|"manages users"| node_users
node_controller -->|"imports users"| node_userio
node_recognition -->|"reads threshold"| node_config
node_recognition -->|"posts images"| node_faceengine
node_configcontroller -->|"updates settings"| node_config
node_configcontroller -->|"manages types"| node_types
node_auth -->|"hashes passwords"| node_crypto
node_sessions -->|"reads and writes"| node_database
node_presence -->|"reads and writes"| node_database
node_audit -->|"queries records"| node_database
node_users -->|"reads and writes"| node_database
node_faceusers -->|"stores collections"| node_database
node_config -->|"stores settings"| node_database
node_types -->|"stores types"| node_database
node_server -->|"validates connection"| node_database
node_login -.->|"supports access"| node_web
node_sessionsui -.->|"provides screens"| node_web
node_sessionui -.->|"provides screens"| node_web
node_auditui -.->|"provides screens"| node_web
node_dashboard -.->|"provides screens"| node_web
node_usersui -.->|"provides screens"| node_web
node_settingsui -.->|"provides screens"| node_web

click node_web "https://github.com/isaactxr/rpvp/tree/main/frontend/scripts"
click node_login "https://github.com/isaactxr/rpvp/blob/main/frontend/scripts/login.js"
click node_sessionsui "https://github.com/isaactxr/rpvp/blob/main/frontend/scripts/sessoes.js"
click node_sessionui "https://github.com/isaactxr/rpvp/blob/main/frontend/scripts/sessao.js"
click node_auditui "https://github.com/isaactxr/rpvp/blob/main/frontend/scripts/registros.js"
click node_dashboard "https://github.com/isaactxr/rpvp/blob/main/frontend/scripts/dashboard.js"
click node_usersui "https://github.com/isaactxr/rpvp/blob/main/frontend/scripts/usuarios.js"
click node_settingsui "https://github.com/isaactxr/rpvp/blob/main/frontend/scripts/configuracoes.js"
click node_api "https://github.com/isaactxr/rpvp/blob/main/backend/src/routes/reconhecer.js"
click node_authmw "https://github.com/isaactxr/rpvp/blob/main/backend/src/middleware/auth.js"
click node_controller "https://github.com/isaactxr/rpvp/blob/main/backend/src/controllers/reconhecerController.js"
click node_recognition "https://github.com/isaactxr/rpvp/blob/main/backend/src/services/faceRecognitionService.js"
click node_faceengine "https://github.com/isaactxr/rpvp/blob/main/face-recognition/app.py"
click node_faceusers "https://github.com/isaactxr/rpvp/blob/main/backend/src/services/usuarioFaceService.js"
click node_presence "https://github.com/isaactxr/rpvp/blob/main/backend/src/services/presencaService.js"
click node_sessions "https://github.com/isaactxr/rpvp/blob/main/backend/src/services/sessaoService.js"
click node_audit "https://github.com/isaactxr/rpvp/blob/main/backend/src/services/auditoriaService.js"
click node_auditexport "https://github.com/isaactxr/rpvp/blob/main/backend/src/services/auditoriaExportService.js"
click node_sessionexport "https://github.com/isaactxr/rpvp/blob/main/backend/src/services/sessaoExportService.js"
click node_users "https://github.com/isaactxr/rpvp/blob/main/backend/src/services/usuarioService.js"
click node_userio "https://github.com/isaactxr/rpvp/blob/main/backend/src/services/usuarioImportExportService.js"
click node_auth "https://github.com/isaactxr/rpvp/blob/main/backend/src/services/authService.js"
click node_crypto "https://github.com/isaactxr/rpvp/blob/main/backend/src/services/cryptoService.js"
click node_configcontroller "https://github.com/isaactxr/rpvp/blob/main/backend/src/controllers/adminController.js"
click node_config "https://github.com/isaactxr/rpvp/blob/main/backend/src/services/configService.js"
click node_types "https://github.com/isaactxr/rpvp/blob/main/backend/src/services/tipoSessaoService.js"
click node_database "https://github.com/isaactxr/rpvp/blob/main/backend/src/config/database.js"
click node_server "https://github.com/isaactxr/rpvp/blob/main/backend/server.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_web,node_login,node_sessionsui,node_sessionui,node_auditui,node_dashboard,node_usersui,node_settingsui toneBlue
class node_api,node_authmw,node_controller toneAmber
class node_recognition,node_faceengine,node_faceusers,node_presence,node_sessions,node_audit,node_auditexport,node_sessionexport toneMint
class node_users,node_userio,node_auth,node_crypto,node_configcontroller,node_config,node_types toneRose
class node_database,node_server,node_person toneIndigo
```

## Components

### Web interface

- [Browser modules](https://github.com/isaactxr/rpvp/tree/main/frontend/scripts): `frontend/scripts`
- [Login and password](https://github.com/isaactxr/rpvp/blob/main/frontend/scripts/login.js): `frontend/scripts/login.js`
- [Session management](https://github.com/isaactxr/rpvp/blob/main/frontend/scripts/sessoes.js): `frontend/scripts/sessoes.js`
- [Session detail](https://github.com/isaactxr/rpvp/blob/main/frontend/scripts/sessao.js): `frontend/scripts/sessao.js`
- [Attendance audit](https://github.com/isaactxr/rpvp/blob/main/frontend/scripts/registros.js): `frontend/scripts/registros.js`
- [Operations dashboard](https://github.com/isaactxr/rpvp/blob/main/frontend/scripts/dashboard.js): `frontend/scripts/dashboard.js`
- [User administration](https://github.com/isaactxr/rpvp/blob/main/frontend/scripts/usuarios.js): `frontend/scripts/usuarios.js`
- [System settings](https://github.com/isaactxr/rpvp/blob/main/frontend/scripts/configuracoes.js): `frontend/scripts/configuracoes.js`

### HTTP and access

- [HTTP routes](https://github.com/isaactxr/rpvp/blob/main/backend/src/routes/reconhecer.js): `backend/src/routes/reconhecer.js`
- [Auth and roles](https://github.com/isaactxr/rpvp/blob/main/backend/src/middleware/auth.js): `backend/src/middleware/auth.js`
- [Domain handlers](https://github.com/isaactxr/rpvp/blob/main/backend/src/controllers/reconhecerController.js): `backend/src/controllers/reconhecerController.js`

### Attendance operations

- [Face recognition client](https://github.com/isaactxr/rpvp/blob/main/backend/src/services/faceRecognitionService.js): `backend/src/services/faceRecognitionService.js`
- [Recognition engine](https://github.com/isaactxr/rpvp/blob/main/face-recognition/app.py): `face-recognition/app.py`
- [Face collections](https://github.com/isaactxr/rpvp/blob/main/backend/src/services/usuarioFaceService.js): `backend/src/services/usuarioFaceService.js`
- [Presence records](https://github.com/isaactxr/rpvp/blob/main/backend/src/services/presencaService.js): `backend/src/services/presencaService.js`
- [Session lifecycle](https://github.com/isaactxr/rpvp/blob/main/backend/src/services/sessaoService.js): `backend/src/services/sessaoService.js`
- [Audit queries](https://github.com/isaactxr/rpvp/blob/main/backend/src/services/auditoriaService.js): `backend/src/services/auditoriaService.js`
- [Audit exports](https://github.com/isaactxr/rpvp/blob/main/backend/src/services/auditoriaExportService.js): `backend/src/services/auditoriaExportService.js`
- [Session exports](https://github.com/isaactxr/rpvp/blob/main/backend/src/services/sessaoExportService.js): `backend/src/services/sessaoExportService.js`

### Administration

- [User management](https://github.com/isaactxr/rpvp/blob/main/backend/src/services/usuarioService.js): `backend/src/services/usuarioService.js`
- [User import/export](https://github.com/isaactxr/rpvp/blob/main/backend/src/services/usuarioImportExportService.js): `backend/src/services/usuarioImportExportService.js`
- [Authentication service](https://github.com/isaactxr/rpvp/blob/main/backend/src/services/authService.js): `backend/src/services/authService.js`
- [Password cryptography](https://github.com/isaactxr/rpvp/blob/main/backend/src/services/cryptoService.js): `backend/src/services/cryptoService.js`
- [Admin handlers](https://github.com/isaactxr/rpvp/blob/main/backend/src/controllers/adminController.js): `backend/src/controllers/adminController.js`
- [Runtime configuration](https://github.com/isaactxr/rpvp/blob/main/backend/src/services/configService.js): `backend/src/services/configService.js`
- [Session types](https://github.com/isaactxr/rpvp/blob/main/backend/src/services/tipoSessaoService.js): `backend/src/services/tipoSessaoService.js`

### Runtime and persistence

- [PostgreSQL](https://github.com/isaactxr/rpvp/blob/main/backend/src/config/database.js): `backend/src/config/database.js`
- [Express application](https://github.com/isaactxr/rpvp/blob/main/backend/server.js): `backend/server.js`

### Other components

- **Staff and admins**

## Connections

- Staff and admins → Browser modules: uses (evidence: `README.md`)
- Browser modules → HTTP routes: calls API
- HTTP routes → Auth and roles: authenticates (evidence: `backend/src/routes/reconhecer.js`)
- HTTP routes → Domain handlers: dispatches (evidence: `backend/src/routes/reconhecer.js`)
- Auth and roles → Authentication service: validates session (evidence: `backend/src/middleware/auth.js`)
- Domain handlers → Face recognition client: requests match (evidence: `backend/src/controllers/reconhecerController.js`)
- Domain handlers → Face collections: loads candidates (evidence: `backend/src/controllers/reconhecerController.js`)
- Domain handlers → Presence records: records attendance (evidence: `backend/src/controllers/reconhecerController.js`)
- Domain handlers → Session lifecycle: handles sessions (evidence: `backend/src/controllers/reconhecerController.js`)
- Domain handlers → Audit queries: queries audit (evidence: `backend/src/controllers/reconhecerController.js`)
- Domain handlers → Audit exports: exports audit (evidence: `backend/src/controllers/reconhecerController.js`)
- Domain handlers → Session exports: exports sessions (evidence: `backend/src/controllers/reconhecerController.js`)
- Domain handlers → User management: manages users (evidence: `backend/src/controllers/reconhecerController.js`)
- Domain handlers → User import/export: imports users (evidence: `backend/src/controllers/reconhecerController.js`)
- Face recognition client → Runtime configuration: reads threshold (evidence: `backend/src/services/faceRecognitionService.js`)
- Face recognition client → Recognition engine: posts images (evidence: `backend/src/services/faceRecognitionService.js`)
- Admin handlers → Runtime configuration: updates settings (evidence: `backend/src/controllers/adminController.js`)
- Admin handlers → Session types: manages types (evidence: `backend/src/controllers/adminController.js`)
- Authentication service → Password cryptography: hashes passwords (evidence: `backend/src/services/authService.js`)
- Session lifecycle → PostgreSQL: reads and writes (evidence: `backend/src/services/sessaoService.js`)
- Presence records → PostgreSQL: reads and writes (evidence: `backend/src/services/presencaService.js`)
- Audit queries → PostgreSQL: queries records (evidence: `backend/src/services/auditoriaService.js`)
- User management → PostgreSQL: reads and writes (evidence: `backend/src/services/usuarioService.js`)
- Face collections → PostgreSQL: stores collections (evidence: `backend/src/services/usuarioFaceService.js`)
- Runtime configuration → PostgreSQL: stores settings (evidence: `backend/src/services/configService.js`)
- Session types → PostgreSQL: stores types (evidence: `backend/src/services/tipoSessaoService.js`)
- Express application → PostgreSQL: validates connection (evidence: `backend/server.js`)
- Login and password → Browser modules: supports access
- Session management → Browser modules: provides screens
- Session detail → Browser modules: provides screens
- Attendance audit → Browser modules: provides screens
- Operations dashboard → Browser modules: provides screens
- User administration → Browser modules: provides screens
- System settings → Browser modules: provides screens
