# batout360/medivault architecture

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

- Interactive diagram: https://gitdiagram.com/batout360/medivault
- Repository: https://github.com/batout360/medivault

## Overview

Medivault is an electronic medical-records system with patient registration and search, clinical records, profile/QR access, document handling, administration, and fingerprint identification. The main user workflow is staff authentication, finding or registering a patient, then viewing or updating authorized patient information and clinical records. The README documents the frontend-to-API and scanner-to-biometric flows; sampled controller references show several API-to-service calls. Some subsystem internals were not sampled, so those capabilities are represented without speculative implementation links.

Main entry points: [`apps/backend/src/main.ts`](https://github.com/batout360/medivault/blob/master/apps/backend/src/main.ts) (Backend API), [`apps/backend/src/modules/biometric/biometric.service.ts`](https://github.com/batout360/medivault/blob/master/apps/backend/src/modules/biometric/biometric.service.ts) (Biometric identification), [`apps/biometric-bridge/src/server.ts`](https://github.com/batout360/medivault/blob/master/apps/biometric-bridge/src/server.ts) (Local scanner bridge), [`apps/backend/src/modules/patients/patients.service.ts`](https://github.com/batout360/medivault/blob/master/apps/backend/src/modules/patients/patients.service.ts) (Patient registration and search)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access and administration"]
  node_auth["Authentication<br/>[auth.service.ts]"]
  node_users["User management<br/>[users.service.ts]"]
  node_admin["Administration<br/>[admin.service.ts]"]
  node_audit["Audit logs"]
end

subgraph group_patient["Patient care"]
  node_patients["Patient registration and search"]
  node_records["Clinical records"]
  node_profile["Medical profile and QR"]
  node_documents["Patient documents"]
end

subgraph group_biometrics["Fingerprint identification"]
  node_biometric["Biometric identification"]
  node_bridge["Local scanner bridge<br/>[server.ts]"]
  node_mfs["MFS100 SDK<br/>[native-sdk.ts]"]
end

subgraph group_client["User interface"]
  node_frontend["Medivault web app<br/>[page.tsx]"]
  node_dashboard["Dashboard"]
end

subgraph group_platform["Shared platform"]
  node_api["Backend API<br/>[main.ts]"]
  node_shared["Shared types and DTOs<br/>[index.ts]"]
  node_database[("MongoDB")]
end

node_staff(("Staff or patient"))
node_scanner(("Fingerprint scanner"))

node_staff -->|"uses"| node_frontend
node_frontend -->|"calls over HTTPS"| node_api
node_api -.->|"routes authentication"| node_auth
node_api -.->|"routes patient requests"| node_patients
node_api -.->|"routes record requests"| node_records
node_api -.->|"routes document requests"| node_documents
node_api -.->|"routes profile requests"| node_profile
node_api -.->|"routes biometric requests"| node_biometric
node_api -.->|"routes user requests"| node_users
node_api -.->|"routes admin requests"| node_admin
node_api -.->|"routes audit requests"| node_audit
node_api -.->|"routes dashboard requests"| node_dashboard
node_patients -.->|"reads and writes"| node_database
node_records -.->|"reads and writes"| node_database
node_staff -->|"scans fingerprint"| node_scanner
node_scanner -->|"USB capture"| node_bridge
node_bridge -->|"sends encrypted template"| node_biometric
node_biometric -->|"identifies patient"| node_patients
node_biometric -->|"authorizes access"| node_records
node_bridge -.->|"uses SDK"| node_mfs
node_api -.->|"uses shared contracts"| node_shared

click node_frontend "https://github.com/batout360/medivault/blob/master/apps/frontend/src/app/(app)/patients/%5Bid%5D/page.tsx"
click node_api "https://github.com/batout360/medivault/blob/master/apps/backend/src/main.ts"
click node_auth "https://github.com/batout360/medivault/blob/master/apps/backend/src/auth/auth.service.ts"
click node_users "https://github.com/batout360/medivault/blob/master/apps/backend/src/modules/users/users.service.ts"
click node_admin "https://github.com/batout360/medivault/blob/master/apps/backend/src/modules/admin/admin.service.ts"
click node_audit "https://github.com/batout360/medivault/blob/master/apps/backend/src/modules/audit-logs/audit-logs.service.ts"
click node_patients "https://github.com/batout360/medivault/blob/master/apps/backend/src/modules/patients/patients.service.ts"
click node_records "https://github.com/batout360/medivault/blob/master/apps/backend/src/modules/medical-records/medical-records.service.ts"
click node_profile "https://github.com/batout360/medivault/blob/master/apps/backend/src/modules/medical-profile/medical-profile.service.ts"
click node_documents "https://github.com/batout360/medivault/blob/master/apps/backend/src/modules/documents/documents.service.ts"
click node_dashboard "https://github.com/batout360/medivault/blob/master/apps/backend/src/modules/dashboard/dashboard.service.ts"
click node_biometric "https://github.com/batout360/medivault/blob/master/apps/backend/src/modules/biometric/biometric.service.ts"
click node_bridge "https://github.com/batout360/medivault/blob/master/apps/biometric-bridge/src/server.ts"
click node_mfs "https://github.com/batout360/medivault/blob/master/packages/mfs100-sdk/src/native-sdk.ts"
click node_shared "https://github.com/batout360/medivault/blob/master/packages/shared/src/index.ts"

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_auth,node_users,node_admin,node_audit toneBlue
class node_patients,node_records,node_profile,node_documents toneAmber
class node_biometric,node_bridge,node_mfs toneMint
class node_frontend,node_dashboard toneRose
class node_api,node_shared,node_database,node_staff,node_scanner toneIndigo
```

## Components

### Access and administration

- [Authentication](https://github.com/batout360/medivault/blob/master/apps/backend/src/auth/auth.service.ts): `apps/backend/src/auth/auth.service.ts`
- [User management](https://github.com/batout360/medivault/blob/master/apps/backend/src/modules/users/users.service.ts): `apps/backend/src/modules/users/users.service.ts`
- [Administration](https://github.com/batout360/medivault/blob/master/apps/backend/src/modules/admin/admin.service.ts): `apps/backend/src/modules/admin/admin.service.ts`
- [Audit logs](https://github.com/batout360/medivault/blob/master/apps/backend/src/modules/audit-logs/audit-logs.service.ts): `apps/backend/src/modules/audit-logs/audit-logs.service.ts`

### Patient care

- [Patient registration and search](https://github.com/batout360/medivault/blob/master/apps/backend/src/modules/patients/patients.service.ts): `apps/backend/src/modules/patients/patients.service.ts`
- [Clinical records](https://github.com/batout360/medivault/blob/master/apps/backend/src/modules/medical-records/medical-records.service.ts): `apps/backend/src/modules/medical-records/medical-records.service.ts`
- [Medical profile and QR](https://github.com/batout360/medivault/blob/master/apps/backend/src/modules/medical-profile/medical-profile.service.ts): `apps/backend/src/modules/medical-profile/medical-profile.service.ts`
- [Patient documents](https://github.com/batout360/medivault/blob/master/apps/backend/src/modules/documents/documents.service.ts): `apps/backend/src/modules/documents/documents.service.ts`

### Fingerprint identification

- [Biometric identification](https://github.com/batout360/medivault/blob/master/apps/backend/src/modules/biometric/biometric.service.ts): `apps/backend/src/modules/biometric/biometric.service.ts`
- [Local scanner bridge](https://github.com/batout360/medivault/blob/master/apps/biometric-bridge/src/server.ts): `apps/biometric-bridge/src/server.ts`
- [MFS100 SDK](https://github.com/batout360/medivault/blob/master/packages/mfs100-sdk/src/native-sdk.ts): `packages/mfs100-sdk/src/native-sdk.ts`

### User interface

- [Medivault web app](https://github.com/batout360/medivault/blob/master/apps/frontend/src/app/(app)/patients/%5Bid%5D/page.tsx): `apps/frontend/src/app/(app)/patients/[id]/page.tsx`
- [Dashboard](https://github.com/batout360/medivault/blob/master/apps/backend/src/modules/dashboard/dashboard.service.ts): `apps/backend/src/modules/dashboard/dashboard.service.ts`

### Shared platform

- [Backend API](https://github.com/batout360/medivault/blob/master/apps/backend/src/main.ts): `apps/backend/src/main.ts`
- [Shared types and DTOs](https://github.com/batout360/medivault/blob/master/packages/shared/src/index.ts): `packages/shared/src/index.ts`
- **MongoDB**

### Other components

- **Staff or patient**
- **Fingerprint scanner**

## Connections

- Staff or patient → Medivault web app: uses (evidence: `README.md`)
- Medivault web app → Backend API: calls over HTTPS (evidence: `README.md`)
- Backend API → Authentication: routes authentication
- Backend API → Patient registration and search: routes patient requests
- Backend API → Clinical records: routes record requests
- Backend API → Patient documents: routes document requests
- Backend API → Medical profile and QR: routes profile requests
- Backend API → Biometric identification: routes biometric requests
- Backend API → User management: routes user requests
- Backend API → Administration: routes admin requests
- Backend API → Audit logs: routes audit requests
- Backend API → Dashboard: routes dashboard requests
- Patient registration and search → MongoDB: reads and writes
- Clinical records → MongoDB: reads and writes
- Staff or patient → Fingerprint scanner: scans fingerprint (evidence: `README.md`)
- Fingerprint scanner → Local scanner bridge: USB capture (evidence: `README.md`)
- Local scanner bridge → Biometric identification: sends encrypted template (evidence: `README.md`)
- Biometric identification → Patient registration and search: identifies patient (evidence: `README.md`)
- Biometric identification → Clinical records: authorizes access (evidence: `README.md`)
- Local scanner bridge → MFS100 SDK: uses SDK
- Backend API → Shared types and DTOs: uses shared contracts
