# melvingamanajr/e-rams-2.0 architecture

> Architecture diagram of the GitHub repository melvingamanajr/e-rams-2.0, 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/melvingamanajr/e-rams-2.0
- Repository: https://github.com/melvingamanajr/e-rams-2.0

## Overview

e-RAMS is a municipal employee attendance system. HR maintains employees and schedules, records or corrects four daily attendance events, and reviews monthly time records and the audit trail; kiosks can capture face-based punches after consent-based enrollment. The web app calls a NestJS API, which applies authentication and domain services over PostgreSQL; optional FastAPI face recognition supports enrollment and kiosk identification. The graph preserves documented reporting, live monitoring, PWA, and administration capabilities. Some paths are linked from README or index evidence; unsampled relationships are left unconnected.

Main entry points: [`apps/web/src/api.ts`](https://github.com/melvingamanajr/e-rams-2.0/blob/main/apps/web/src/api.ts) (API client), [`apps/api/src/controllers.ts`](https://github.com/melvingamanajr/e-rams-2.0/blob/main/apps/api/src/controllers.ts) (HTTP controllers), [`apps/api/src/attendance.ts`](https://github.com/melvingamanajr/e-rams-2.0/blob/main/apps/api/src/attendance.ts) (Punch processing), [`apps/api/src/biometrics.ts`](https://github.com/melvingamanajr/e-rams-2.0/blob/main/apps/api/src/biometrics.ts) (Consent and biometrics)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web workspace"]
  node_web_shell["Workspace shell<br/>[App.vue]"]
  node_web_routes["Page routing<br/>[router.ts]"]
  node_web_api["API client<br/>[api.ts]"]
  node_employees_ui["Employee directory<br/>[Employees.vue]"]
  node_attendance_ui["Attendance records<br/>[Attendance.vue]"]
  node_schedule_ui["Schedules<br/>[Shifts.vue]"]
  node_reports_ui["Time records<br/>[Reports.vue]"]
  node_audit_ui["Audit trail<br/>[Audit.vue]"]
  node_dashboard_ui["Overview dashboard<br/>[Dashboard.vue]"]
  node_admin_ui["Administration<br/>[Settings.vue]"]
  node_kiosk_ui["Kiosk capture<br/>[Kiosk.vue]"]
  node_camera["Camera capture<br/>[Camera.vue]"]
end

subgraph group_api["API and domain"]
  node_api_entry["HTTP controllers<br/>[controllers.ts]"]
  node_attendance["Punch processing<br/>[attendance.ts]"]
  node_time_rules["Schedule calculations<br/>[time.ts]"]
  node_reports["DTR rendering<br/>[reports.ts]"]
end

subgraph group_data["Persistence and security"]
  node_auth["Authentication and roles<br/>[auth.ts]"]
  node_database[("PostgreSQL data<br/>[db.ts]")]
  node_crypto["Template encryption<br/>[crypto.ts]"]
  node_limits["Rate limits<br/>[limits.ts]"]
end

subgraph group_face["Face recognition"]
  node_biometrics["Consent and biometrics<br/>[biometrics.ts]"]
  node_face_service["Face extraction and matching<br/>[main.py]"]
end

subgraph group_live["Live and install"]
  node_live_service["Live invalidations<br/>[live.ts]"]
  node_service_worker["PWA shell caching<br/>[sw.js]"]
end

node_staff(("HR and staff"))
node_kiosk_user(("Kiosk user"))

node_staff -->|"uses"| node_web_shell
node_kiosk_user -->|"captures punch"| node_kiosk_ui
node_web_shell -->|"renders routes"| node_web_routes
node_web_shell -->|"signs in"| node_web_api
node_employees_ui -->|"requests data"| node_web_api
node_attendance_ui -->|"requests data"| node_web_api
node_schedule_ui -->|"requests data"| node_web_api
node_reports_ui -->|"requests data"| node_web_api
node_audit_ui -->|"requests data"| node_web_api
node_dashboard_ui -->|"requests data"| node_web_api
node_admin_ui -->|"requests data"| node_web_api
node_kiosk_ui -->|"captures image"| node_camera
node_kiosk_ui -->|"submits capture"| node_web_api
node_web_api -->|"calls HTTP API"| node_api_entry
node_api_entry -->|"checks access"| node_auth
node_api_entry -->|"records and queries"| node_attendance
node_api_entry -->|"enrolls and identifies"| node_biometrics
node_api_entry -->|"renders PDF"| node_reports
node_api_entry -->|"manages records"| node_database
node_attendance -->|"reads and writes"| node_database
node_attendance -->|"calculates work dates"| node_time_rules
node_attendance -->|"signals changes"| node_live_service
node_attendance -->|"provides DTR data"| node_reports
node_biometrics -->|"stores templates"| node_database
node_biometrics -->|"encrypts templates"| node_crypto
node_biometrics -->|"requests extraction and match"| node_face_service
node_biometrics -->|"submits recognized punch"| node_attendance
node_reports -->|"uses calculations"| node_time_rules
node_auth -->|"validates sessions"| node_database
node_api_entry -->|"checks request limits"| node_limits
node_web_shell -.->|"offers installable shell"| node_service_worker
node_web_api -.->|"refreshes on invalidation"| node_live_service

click node_web_shell "https://github.com/melvingamanajr/e-rams-2.0/blob/main/apps/web/src/App.vue"
click node_web_routes "https://github.com/melvingamanajr/e-rams-2.0/blob/main/apps/web/src/router.ts"
click node_web_api "https://github.com/melvingamanajr/e-rams-2.0/blob/main/apps/web/src/api.ts"
click node_employees_ui "https://github.com/melvingamanajr/e-rams-2.0/blob/main/apps/web/src/pages/Employees.vue"
click node_attendance_ui "https://github.com/melvingamanajr/e-rams-2.0/blob/main/apps/web/src/pages/Attendance.vue"
click node_schedule_ui "https://github.com/melvingamanajr/e-rams-2.0/blob/main/apps/web/src/pages/Shifts.vue"
click node_reports_ui "https://github.com/melvingamanajr/e-rams-2.0/blob/main/apps/web/src/pages/Reports.vue"
click node_audit_ui "https://github.com/melvingamanajr/e-rams-2.0/blob/main/apps/web/src/pages/Audit.vue"
click node_dashboard_ui "https://github.com/melvingamanajr/e-rams-2.0/blob/main/apps/web/src/pages/Dashboard.vue"
click node_admin_ui "https://github.com/melvingamanajr/e-rams-2.0/blob/main/apps/web/src/pages/Settings.vue"
click node_kiosk_ui "https://github.com/melvingamanajr/e-rams-2.0/blob/main/apps/web/src/pages/Kiosk.vue"
click node_camera "https://github.com/melvingamanajr/e-rams-2.0/blob/main/apps/web/src/components/Camera.vue"
click node_api_entry "https://github.com/melvingamanajr/e-rams-2.0/blob/main/apps/api/src/controllers.ts"
click node_auth "https://github.com/melvingamanajr/e-rams-2.0/blob/main/apps/api/src/auth.ts"
click node_attendance "https://github.com/melvingamanajr/e-rams-2.0/blob/main/apps/api/src/attendance.ts"
click node_time_rules "https://github.com/melvingamanajr/e-rams-2.0/blob/main/apps/api/src/time.ts"
click node_biometrics "https://github.com/melvingamanajr/e-rams-2.0/blob/main/apps/api/src/biometrics.ts"
click node_face_service "https://github.com/melvingamanajr/e-rams-2.0/blob/main/services/face/app/main.py"
click node_reports "https://github.com/melvingamanajr/e-rams-2.0/blob/main/apps/api/src/reports.ts"
click node_database "https://github.com/melvingamanajr/e-rams-2.0/blob/main/apps/api/src/db.ts"
click node_crypto "https://github.com/melvingamanajr/e-rams-2.0/blob/main/apps/api/src/crypto.ts"
click node_limits "https://github.com/melvingamanajr/e-rams-2.0/blob/main/apps/api/src/limits.ts"
click node_live_service "https://github.com/melvingamanajr/e-rams-2.0/blob/main/apps/api/src/live.ts"
click node_service_worker "https://github.com/melvingamanajr/e-rams-2.0/blob/main/apps/web/public/sw.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_shell,node_web_routes,node_web_api,node_employees_ui,node_attendance_ui,node_schedule_ui,node_reports_ui,node_audit_ui,node_dashboard_ui,node_admin_ui,node_kiosk_ui,node_camera,node_kiosk_user toneBlue
class node_api_entry,node_attendance,node_time_rules,node_reports toneAmber
class node_auth,node_database,node_crypto,node_limits toneMint
class node_biometrics,node_face_service toneRose
class node_live_service,node_service_worker,node_staff toneIndigo
```

## Components

### Web workspace

- [Workspace shell](https://github.com/melvingamanajr/e-rams-2.0/blob/main/apps/web/src/App.vue): `apps/web/src/App.vue`
- [Page routing](https://github.com/melvingamanajr/e-rams-2.0/blob/main/apps/web/src/router.ts): `apps/web/src/router.ts`
- [API client](https://github.com/melvingamanajr/e-rams-2.0/blob/main/apps/web/src/api.ts): `apps/web/src/api.ts`
- [Employee directory](https://github.com/melvingamanajr/e-rams-2.0/blob/main/apps/web/src/pages/Employees.vue): `apps/web/src/pages/Employees.vue`
- [Attendance records](https://github.com/melvingamanajr/e-rams-2.0/blob/main/apps/web/src/pages/Attendance.vue): `apps/web/src/pages/Attendance.vue`
- [Schedules](https://github.com/melvingamanajr/e-rams-2.0/blob/main/apps/web/src/pages/Shifts.vue): `apps/web/src/pages/Shifts.vue`
- [Time records](https://github.com/melvingamanajr/e-rams-2.0/blob/main/apps/web/src/pages/Reports.vue): `apps/web/src/pages/Reports.vue`
- [Audit trail](https://github.com/melvingamanajr/e-rams-2.0/blob/main/apps/web/src/pages/Audit.vue): `apps/web/src/pages/Audit.vue`
- [Overview dashboard](https://github.com/melvingamanajr/e-rams-2.0/blob/main/apps/web/src/pages/Dashboard.vue): `apps/web/src/pages/Dashboard.vue`
- [Administration](https://github.com/melvingamanajr/e-rams-2.0/blob/main/apps/web/src/pages/Settings.vue): `apps/web/src/pages/Settings.vue`
- [Kiosk capture](https://github.com/melvingamanajr/e-rams-2.0/blob/main/apps/web/src/pages/Kiosk.vue): `apps/web/src/pages/Kiosk.vue`
- [Camera capture](https://github.com/melvingamanajr/e-rams-2.0/blob/main/apps/web/src/components/Camera.vue): `apps/web/src/components/Camera.vue`

### API and domain

- [HTTP controllers](https://github.com/melvingamanajr/e-rams-2.0/blob/main/apps/api/src/controllers.ts): `apps/api/src/controllers.ts`
- [Punch processing](https://github.com/melvingamanajr/e-rams-2.0/blob/main/apps/api/src/attendance.ts): `apps/api/src/attendance.ts`
- [Schedule calculations](https://github.com/melvingamanajr/e-rams-2.0/blob/main/apps/api/src/time.ts): `apps/api/src/time.ts`
- [DTR rendering](https://github.com/melvingamanajr/e-rams-2.0/blob/main/apps/api/src/reports.ts): `apps/api/src/reports.ts`

### Persistence and security

- [Authentication and roles](https://github.com/melvingamanajr/e-rams-2.0/blob/main/apps/api/src/auth.ts): `apps/api/src/auth.ts`
- [PostgreSQL data](https://github.com/melvingamanajr/e-rams-2.0/blob/main/apps/api/src/db.ts): `apps/api/src/db.ts`
- [Template encryption](https://github.com/melvingamanajr/e-rams-2.0/blob/main/apps/api/src/crypto.ts): `apps/api/src/crypto.ts`
- [Rate limits](https://github.com/melvingamanajr/e-rams-2.0/blob/main/apps/api/src/limits.ts): `apps/api/src/limits.ts`

### Face recognition

- [Consent and biometrics](https://github.com/melvingamanajr/e-rams-2.0/blob/main/apps/api/src/biometrics.ts): `apps/api/src/biometrics.ts`
- [Face extraction and matching](https://github.com/melvingamanajr/e-rams-2.0/blob/main/services/face/app/main.py): `services/face/app/main.py`

### Live and install

- [Live invalidations](https://github.com/melvingamanajr/e-rams-2.0/blob/main/apps/api/src/live.ts): `apps/api/src/live.ts`
- [PWA shell caching](https://github.com/melvingamanajr/e-rams-2.0/blob/main/apps/web/public/sw.js): `apps/web/public/sw.js`

### Other components

- **HR and staff**
- **Kiosk user**

## Connections

- HR and staff → Workspace shell: uses (evidence: `apps/web/src/App.vue`)
- Kiosk user → Kiosk capture: captures punch (evidence: `README.md`)
- Workspace shell → Page routing: renders routes (evidence: `apps/web/src/router.ts`)
- Workspace shell → API client: signs in (evidence: `apps/web/src/App.vue`)
- Employee directory → API client: requests data (evidence: `apps/web/src/pages/Employees.vue`)
- Attendance records → API client: requests data (evidence: `apps/web/src/pages/Attendance.vue`)
- Schedules → API client: requests data (evidence: `apps/web/src/pages/Shifts.vue`)
- Time records → API client: requests data (evidence: `apps/web/src/pages/Reports.vue`)
- Audit trail → API client: requests data (evidence: `apps/web/src/pages/Audit.vue`)
- Overview dashboard → API client: requests data (evidence: `apps/web/src/pages/Dashboard.vue`)
- Administration → API client: requests data (evidence: `apps/web/src/pages/Settings.vue`)
- Kiosk capture → Camera capture: captures image (evidence: `apps/web/src/pages/Kiosk.vue`)
- Kiosk capture → API client: submits capture (evidence: `apps/web/src/pages/Kiosk.vue`)
- API client → HTTP controllers: calls HTTP API (evidence: `README.md`)
- HTTP controllers → Authentication and roles: checks access (evidence: `apps/api/src/controllers.ts`)
- HTTP controllers → Punch processing: records and queries (evidence: `apps/api/src/controllers.ts`)
- HTTP controllers → Consent and biometrics: enrolls and identifies (evidence: `apps/api/src/controllers.ts`)
- HTTP controllers → DTR rendering: renders PDF (evidence: `apps/api/src/controllers.ts`)
- HTTP controllers → PostgreSQL data: manages records (evidence: `apps/api/src/controllers.ts`)
- Punch processing → PostgreSQL data: reads and writes (evidence: `apps/api/src/attendance.ts`)
- Punch processing → Schedule calculations: calculates work dates (evidence: `apps/api/src/attendance.ts`)
- Punch processing → Live invalidations: signals changes (evidence: `apps/api/src/attendance.ts`)
- Punch processing → DTR rendering: provides DTR data (evidence: `apps/api/src/controllers.ts`)
- Consent and biometrics → PostgreSQL data: stores templates (evidence: `apps/api/src/biometrics.ts`)
- Consent and biometrics → Template encryption: encrypts templates (evidence: `apps/api/src/biometrics.ts`)
- Consent and biometrics → Face extraction and matching: requests extraction and match (evidence: `apps/api/src/biometrics.ts`)
- Consent and biometrics → Punch processing: submits recognized punch (evidence: `apps/api/src/controllers.ts`)
- DTR rendering → Schedule calculations: uses calculations (evidence: `apps/api/src/reports.ts`)
- Authentication and roles → PostgreSQL data: validates sessions (evidence: `apps/api/src/auth.ts`)
- HTTP controllers → Rate limits: checks request limits (evidence: `apps/api/src/controllers.ts`)
- Workspace shell → PWA shell caching: offers installable shell (evidence: `README.md`)
- API client → Live invalidations: refreshes on invalidation (evidence: `README.md`)
