# marzouck13/mcs2 architecture

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

- Interactive diagram: https://gitdiagram.com/marzouck13/mcs2
- Repository: https://github.com/marzouck13/mcs2

## Overview

Mon Carnet Santé is a French healthcare portal for patients and health professionals. Its main workflow is to serve role-protected pages, establish a session, and let browser features request backend operations through the frontend API proxy. The visible capabilities include patient records, consent and access history, QR-code sharing and scanning, clinical consultations and prescriptions, pharmacy access, emergency mode, and teleconsultation. The excerpts show the server, session and page-routing layers, plus one QR-sharing flow; most page-to-API behavior is not sampled, so those connections are omitted.

Main entry points: [`frontend-html/serveur.js`](https://github.com/marzouck13/mcs2/blob/main/frontend-html/serveur.js) (Express server), [`frontend-html/src/routes/pages.routes.js`](https://github.com/marzouck13/mcs2/blob/main/frontend-html/src/routes/pages.routes.js) (Page routes), [`frontend-html/src/routes/session.routes.js`](https://github.com/marzouck13/mcs2/blob/main/frontend-html/src/routes/session.routes.js) (Session routes), [`frontend-html/src/proxy/api.proxy.js`](https://github.com/marzouck13/mcs2/blob/main/frontend-html/src/proxy/api.proxy.js) (Backend API proxy)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Frontend runtime"]
  node_server["Express server<br/>[serveur.js]"]
  node_page_routes["Page routes<br/>[pages.routes.js]"]
  node_path_utils["Asset paths<br/>[chemins.js]"]
  node_config["Environment config"]
  node_api_client["Browser API client<br/>[api-client.js]"]
  node_api_proxy["Backend API proxy<br/>[api.proxy.js]"]
  node_alerts["User alerts<br/>[alertes.js]"]
end

subgraph group_identity["Sessions and access"]
  node_session_routes["Session routes<br/>[session.routes.js]"]
  node_auth["JWT verification<br/>[auth.js]"]
  node_roles["Role checks<br/>[roles.js]"]
  node_rate_limit["Login limits<br/>[limite-requetes.js]"]
end

subgraph group_patient["Patient features"]
  node_patient_ui["Patient portal pages"]
  node_qr_relatives["Relative QR sharing"]
  node_qr_utils["QR utilities<br/>[utilitaires-qr.js]"]
  node_patient_layout["Patient layout<br/>[layout-patient.js]"]
end

subgraph group_care["Professional care"]
  node_professional_ui["Clinical pages"]
  node_business_components["Business components"]
  node_video_sharing["Video sharing<br/>[partage-visio.js]"]
end

node_user(("Portal user"))
node_backend["Healthcare backend"]

node_user -->|"requests pages"| node_server
node_server -->|"mounts sessions"| node_session_routes
node_server -->|"mounts API"| node_api_proxy
node_server -->|"mounts pages"| node_page_routes
node_server -->|"resolves assets"| node_path_utils
node_page_routes -->|"resolves pages"| node_path_utils
node_page_routes -->|"checks tokens"| node_auth
node_page_routes -->|"checks roles"| node_roles
node_session_routes -->|"limits login"| node_rate_limit
node_session_routes -->|"reads settings"| node_config
node_auth -->|"reads JWT settings"| node_config
node_session_routes -->|"forwards login"| node_backend
node_api_proxy -->|"reads backend URL"| node_config
node_api_proxy -->|"forwards API calls"| node_backend
node_user -.->|"uses portal"| node_api_client
node_api_client -.->|"sends API requests"| node_api_proxy
node_qr_relatives -->|"requests QR data"| node_api_client
node_qr_relatives -->|"downloads or shares"| node_qr_utils

click node_server "https://github.com/marzouck13/mcs2/blob/main/frontend-html/serveur.js"
click node_page_routes "https://github.com/marzouck13/mcs2/blob/main/frontend-html/src/routes/pages.routes.js"
click node_path_utils "https://github.com/marzouck13/mcs2/blob/main/frontend-html/src/utilitaires/chemins.js"
click node_session_routes "https://github.com/marzouck13/mcs2/blob/main/frontend-html/src/routes/session.routes.js"
click node_auth "https://github.com/marzouck13/mcs2/blob/main/frontend-html/src/intergiciels/auth.js"
click node_roles "https://github.com/marzouck13/mcs2/blob/main/frontend-html/src/intergiciels/roles.js"
click node_rate_limit "https://github.com/marzouck13/mcs2/blob/main/frontend-html/src/intergiciels/limite-requetes.js"
click node_config "https://github.com/marzouck13/mcs2/blob/main/frontend-html/src/config/variables-environnement.js"
click node_api_client "https://github.com/marzouck13/mcs2/blob/main/frontend-html/public/js/api-client.js"
click node_api_proxy "https://github.com/marzouck13/mcs2/blob/main/frontend-html/src/proxy/api.proxy.js"
click node_patient_ui "https://github.com/marzouck13/mcs2/tree/main/frontend-html/public/js/pages"
click node_qr_relatives "https://github.com/marzouck13/mcs2/blob/main/frontend-html/public/js/pages/patient-qr-proches.js"
click node_qr_utils "https://github.com/marzouck13/mcs2/blob/main/frontend-html/public/js/utilitaires-qr.js"
click node_patient_layout "https://github.com/marzouck13/mcs2/blob/main/frontend-html/public/js/layout-patient.js"
click node_professional_ui "https://github.com/marzouck13/mcs2/tree/main/frontend-html/public/js/pages"
click node_business_components "https://github.com/marzouck13/mcs2/blob/main/frontend-html/public/js/composants-metier.js"
click node_video_sharing "https://github.com/marzouck13/mcs2/blob/main/frontend-html/public/js/partage-visio.js"
click node_alerts "https://github.com/marzouck13/mcs2/blob/main/frontend-html/public/js/alertes.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_server,node_page_routes,node_path_utils,node_config,node_api_client,node_api_proxy,node_alerts,node_user toneBlue
class node_session_routes,node_auth,node_roles,node_rate_limit toneAmber
class node_patient_ui,node_qr_relatives,node_qr_utils,node_patient_layout toneMint
class node_professional_ui,node_business_components,node_video_sharing toneRose
class node_backend toneIndigo
```

## Components

### Frontend runtime

- [Express server](https://github.com/marzouck13/mcs2/blob/main/frontend-html/serveur.js): `frontend-html/serveur.js`
- [Page routes](https://github.com/marzouck13/mcs2/blob/main/frontend-html/src/routes/pages.routes.js): `frontend-html/src/routes/pages.routes.js`
- [Asset paths](https://github.com/marzouck13/mcs2/blob/main/frontend-html/src/utilitaires/chemins.js): `frontend-html/src/utilitaires/chemins.js`
- [Environment config](https://github.com/marzouck13/mcs2/blob/main/frontend-html/src/config/variables-environnement.js): `frontend-html/src/config/variables-environnement.js`
- [Browser API client](https://github.com/marzouck13/mcs2/blob/main/frontend-html/public/js/api-client.js): `frontend-html/public/js/api-client.js`
- [Backend API proxy](https://github.com/marzouck13/mcs2/blob/main/frontend-html/src/proxy/api.proxy.js): `frontend-html/src/proxy/api.proxy.js`
- [User alerts](https://github.com/marzouck13/mcs2/blob/main/frontend-html/public/js/alertes.js): `frontend-html/public/js/alertes.js`

### Sessions and access

- [Session routes](https://github.com/marzouck13/mcs2/blob/main/frontend-html/src/routes/session.routes.js): `frontend-html/src/routes/session.routes.js`
- [JWT verification](https://github.com/marzouck13/mcs2/blob/main/frontend-html/src/intergiciels/auth.js): `frontend-html/src/intergiciels/auth.js`
- [Role checks](https://github.com/marzouck13/mcs2/blob/main/frontend-html/src/intergiciels/roles.js): `frontend-html/src/intergiciels/roles.js`
- [Login limits](https://github.com/marzouck13/mcs2/blob/main/frontend-html/src/intergiciels/limite-requetes.js): `frontend-html/src/intergiciels/limite-requetes.js`

### Patient features

- [Patient portal pages](https://github.com/marzouck13/mcs2/tree/main/frontend-html/public/js/pages): `frontend-html/public/js/pages`
- [Relative QR sharing](https://github.com/marzouck13/mcs2/blob/main/frontend-html/public/js/pages/patient-qr-proches.js): `frontend-html/public/js/pages/patient-qr-proches.js`
- [QR utilities](https://github.com/marzouck13/mcs2/blob/main/frontend-html/public/js/utilitaires-qr.js): `frontend-html/public/js/utilitaires-qr.js`
- [Patient layout](https://github.com/marzouck13/mcs2/blob/main/frontend-html/public/js/layout-patient.js): `frontend-html/public/js/layout-patient.js`

### Professional care

- [Clinical pages](https://github.com/marzouck13/mcs2/tree/main/frontend-html/public/js/pages): `frontend-html/public/js/pages`
- [Business components](https://github.com/marzouck13/mcs2/blob/main/frontend-html/public/js/composants-metier.js): `frontend-html/public/js/composants-metier.js`
- [Video sharing](https://github.com/marzouck13/mcs2/blob/main/frontend-html/public/js/partage-visio.js): `frontend-html/public/js/partage-visio.js`

### Other components

- **Portal user**
- **Healthcare backend**

## Connections

- Portal user → Express server: requests pages (evidence: `frontend-html/serveur.js`)
- Express server → Session routes: mounts sessions (evidence: `frontend-html/serveur.js`)
- Express server → Backend API proxy: mounts API (evidence: `frontend-html/serveur.js`)
- Express server → Page routes: mounts pages (evidence: `frontend-html/serveur.js`)
- Express server → Asset paths: resolves assets (evidence: `frontend-html/serveur.js`)
- Page routes → Asset paths: resolves pages (evidence: `frontend-html/src/routes/pages.routes.js`)
- Page routes → JWT verification: checks tokens (evidence: `frontend-html/src/routes/pages.routes.js`)
- Page routes → Role checks: checks roles (evidence: `frontend-html/src/routes/pages.routes.js`)
- Session routes → Login limits: limits login (evidence: `frontend-html/src/routes/session.routes.js`)
- Session routes → Environment config: reads settings (evidence: `frontend-html/src/routes/session.routes.js`)
- JWT verification → Environment config: reads JWT settings (evidence: `frontend-html/src/intergiciels/auth.js`)
- Session routes → Healthcare backend: forwards login (evidence: `frontend-html/src/routes/session.routes.js`)
- Backend API proxy → Environment config: reads backend URL (evidence: `frontend-html/src/proxy/api.proxy.js`)
- Backend API proxy → Healthcare backend: forwards API calls (evidence: `frontend-html/src/proxy/api.proxy.js`)
- Portal user → Browser API client: uses portal
- Browser API client → Backend API proxy: sends API requests
- Relative QR sharing → Browser API client: requests QR data (evidence: `frontend-html/public/js/pages/patient-qr-proches.js`)
- Relative QR sharing → QR utilities: downloads or shares (evidence: `frontend-html/public/js/pages/patient-qr-proches.js`)
