# mamoud427/gestion_stagiaires architecture

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

## Overview

This is an internship-management application: staff sign in, manage supervisors and interns, view placement statistics, and upload or download internship reports. The React frontend calls an Express API; controllers delegate domain operations to services and MongoDB models, with JWT and audit middleware protecting selected routes. The README is empty, so product scope comes from the source tree and sampled code. Some feature-to-route and deployment wiring is not shown; edges below are limited to indexed references or explicit calls and API paths.

Main entry points: [`frontend/src/App.tsx`](https://github.com/mamoud427/gestion_stagiaires/blob/master/frontend/src/App.tsx) (React app and routes), [`backend/src/index.ts`](https://github.com/mamoud427/gestion_stagiaires/blob/master/backend/src/index.ts) (Express API), [`frontend/src/services/api.ts`](https://github.com/mamoud427/gestion_stagiaires/blob/master/frontend/src/services/api.ts) (HTTP client), [`backend/src/services/Rapport.service.ts`](https://github.com/mamoud427/gestion_stagiaires/blob/master/backend/src/services/Rapport.service.ts) (Report service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Web application"]
  node_app["React app and routes<br/>[App.tsx]"]
  node_login["Sign-in page<br/>[Login.tsx]"]
  node_staffui["Supervisor management<br/>[Encadreurs.tsx]"]
  node_internui["Intern management<br/>[Stagiaires.tsx]"]
  node_dashboardui["Dashboard<br/>[Dashboard.tsx]"]
  node_reportui["Reports page<br/>[Rapports.tsx]"]
  node_reportupload["Report upload UI<br/>[uploadRapport.tsx]"]
  node_api_client["HTTP client<br/>[api.ts]"]
  node_auth_service["Authentication client<br/>[authService.ts]"]
  node_staff_service["Supervisor client"]
  node_intern_service["Intern client"]
  node_dashboard_service["Dashboard client"]
end

subgraph group_api["API and access"]
  node_express["Express API<br/>[index.ts]"]
  node_auth_mw["JWT role guard<br/>[auth.middleware.ts]"]
  node_audit_mw["Audit middleware"]
  node_staff_controller["Supervisor controller"]
  node_intern_controller["Intern controller"]
  node_report_controller["Report controller"]
  node_audit_controller["Audit controller"]
end

subgraph group_domain["Management services"]
  node_staff_service_backend["Supervisor service"]
  node_intern_service_backend["Intern service"]
  node_report_service["Report service<br/>[Rapport.service.ts]"]
  node_audit_service["Audit log service"]
end

subgraph group_data["Persistence and files"]
  node_staff_model[("Supervisor model<br/>[Encadrant.model.ts]")]
  node_intern_model[("Intern model<br/>[Stagiaire.model.ts]")]
  node_audit_model[("Audit log model<br/>[AuditLog.model.ts]")]
  node_report_storage[("Report file storage<br/>[Pdf.service.ts]")]
end

node_staff(("Staff user"))
node_mongo[("MongoDB")]

node_staff -->|"uses"| node_app
node_app -->|"routes to"| node_login
node_app -->|"routes to"| node_staffui
node_app -->|"routes to"| node_internui
node_app -->|"routes to"| node_dashboardui
node_app -->|"routes to"| node_reportui
node_login -->|"signs in via"| node_auth_service
node_staffui -->|"manages supervisors"| node_staff_service
node_internui -->|"manages interns"| node_intern_service
node_reportui -->|"renders"| node_reportupload
node_auth_service -->|"posts login"| node_api_client
node_staff_service -->|"sends requests"| node_api_client
node_intern_service -->|"sends requests"| node_api_client
node_dashboardui -->|"loads statistics"| node_dashboard_service
node_dashboard_service -->|"sends requests"| node_api_client
node_api_client -.->|"calls API"| node_express
node_express -.->|"routes requests"| node_staff_controller
node_express -.->|"routes requests"| node_intern_controller
node_express -.->|"routes requests"| node_report_controller
node_staff_controller -->|"delegates"| node_staff_service_backend
node_intern_controller -->|"delegates"| node_intern_service_backend
node_report_controller -->|"delegates"| node_report_service
node_staff_service_backend -->|"queries"| node_staff_model
node_intern_service_backend -->|"queries"| node_intern_model
node_report_service -->|"reads intern data"| node_intern_model
node_staff_model -.->|"persists"| node_mongo
node_intern_model -.->|"persists"| node_mongo
node_report_service -->|"stores and retrieves"| node_report_storage
node_auth_mw -->|"guards routes"| node_express
node_audit_mw -->|"records activity"| node_audit_service
node_audit_service -->|"writes logs"| node_audit_model
node_audit_controller -->|"reads logs"| node_audit_service
node_express -->|"routes audit query"| node_audit_controller
node_audit_model -.->|"persists"| node_mongo

click node_app "https://github.com/mamoud427/gestion_stagiaires/blob/master/frontend/src/App.tsx"
click node_login "https://github.com/mamoud427/gestion_stagiaires/blob/master/frontend/src/pages/Login.tsx"
click node_staffui "https://github.com/mamoud427/gestion_stagiaires/blob/master/frontend/src/pages/Encadreurs.tsx"
click node_internui "https://github.com/mamoud427/gestion_stagiaires/blob/master/frontend/src/pages/Stagiaires.tsx"
click node_dashboardui "https://github.com/mamoud427/gestion_stagiaires/blob/master/frontend/src/pages/Dashboard.tsx"
click node_reportui "https://github.com/mamoud427/gestion_stagiaires/blob/master/frontend/src/pages/Rapports.tsx"
click node_reportupload "https://github.com/mamoud427/gestion_stagiaires/blob/master/frontend/src/components/uploadRapport.tsx"
click node_api_client "https://github.com/mamoud427/gestion_stagiaires/blob/master/frontend/src/services/api.ts"
click node_auth_service "https://github.com/mamoud427/gestion_stagiaires/blob/master/frontend/src/services/authService.ts"
click node_staff_service "https://github.com/mamoud427/gestion_stagiaires/blob/master/frontend/src/services/encadreurService.ts"
click node_intern_service "https://github.com/mamoud427/gestion_stagiaires/blob/master/frontend/src/services/stagiaireService.ts"
click node_dashboard_service "https://github.com/mamoud427/gestion_stagiaires/blob/master/frontend/src/services/dashboardService.ts"
click node_express "https://github.com/mamoud427/gestion_stagiaires/blob/master/backend/src/index.ts"
click node_auth_mw "https://github.com/mamoud427/gestion_stagiaires/blob/master/backend/src/Middleware/auth.middleware.ts"
click node_audit_mw "https://github.com/mamoud427/gestion_stagiaires/blob/master/backend/src/Middleware/audit.middleware.ts"
click node_staff_controller "https://github.com/mamoud427/gestion_stagiaires/blob/master/backend/src/controllers/Encadrant.controller.ts"
click node_intern_controller "https://github.com/mamoud427/gestion_stagiaires/blob/master/backend/src/controllers/Stagiaire.controller.ts"
click node_report_controller "https://github.com/mamoud427/gestion_stagiaires/blob/master/backend/src/controllers/Rapport.controller.ts"
click node_audit_controller "https://github.com/mamoud427/gestion_stagiaires/blob/master/backend/src/controllers/Audit.controller.ts"
click node_staff_service_backend "https://github.com/mamoud427/gestion_stagiaires/blob/master/backend/src/services/Encadrant.service.ts"
click node_intern_service_backend "https://github.com/mamoud427/gestion_stagiaires/blob/master/backend/src/services/Stagiaire.sevice.ts"
click node_report_service "https://github.com/mamoud427/gestion_stagiaires/blob/master/backend/src/services/Rapport.service.ts"
click node_audit_service "https://github.com/mamoud427/gestion_stagiaires/blob/master/backend/src/services/AuditLog.service.ts"
click node_staff_model "https://github.com/mamoud427/gestion_stagiaires/blob/master/backend/src/models/Encadrant.model.ts"
click node_intern_model "https://github.com/mamoud427/gestion_stagiaires/blob/master/backend/src/models/Stagiaire.model.ts"
click node_audit_model "https://github.com/mamoud427/gestion_stagiaires/blob/master/backend/src/models/AuditLog.model.ts"
click node_report_storage "https://github.com/mamoud427/gestion_stagiaires/blob/master/backend/src/services/Pdf.service.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_app,node_login,node_staffui,node_internui,node_dashboardui,node_reportui,node_reportupload,node_api_client,node_auth_service,node_staff_service,node_intern_service,node_dashboard_service,node_staff toneBlue
class node_express,node_auth_mw,node_audit_mw,node_staff_controller,node_intern_controller,node_report_controller,node_audit_controller,node_mongo toneAmber
class node_staff_service_backend,node_intern_service_backend,node_report_service,node_audit_service toneMint
class node_staff_model,node_intern_model,node_audit_model,node_report_storage toneRose
```

## Components

### Web application

- [React app and routes](https://github.com/mamoud427/gestion_stagiaires/blob/master/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Sign-in page](https://github.com/mamoud427/gestion_stagiaires/blob/master/frontend/src/pages/Login.tsx): `frontend/src/pages/Login.tsx`
- [Supervisor management](https://github.com/mamoud427/gestion_stagiaires/blob/master/frontend/src/pages/Encadreurs.tsx): `frontend/src/pages/Encadreurs.tsx`
- [Intern management](https://github.com/mamoud427/gestion_stagiaires/blob/master/frontend/src/pages/Stagiaires.tsx): `frontend/src/pages/Stagiaires.tsx`
- [Dashboard](https://github.com/mamoud427/gestion_stagiaires/blob/master/frontend/src/pages/Dashboard.tsx): `frontend/src/pages/Dashboard.tsx`
- [Reports page](https://github.com/mamoud427/gestion_stagiaires/blob/master/frontend/src/pages/Rapports.tsx): `frontend/src/pages/Rapports.tsx`
- [Report upload UI](https://github.com/mamoud427/gestion_stagiaires/blob/master/frontend/src/components/uploadRapport.tsx): `frontend/src/components/uploadRapport.tsx`
- [HTTP client](https://github.com/mamoud427/gestion_stagiaires/blob/master/frontend/src/services/api.ts): `frontend/src/services/api.ts`
- [Authentication client](https://github.com/mamoud427/gestion_stagiaires/blob/master/frontend/src/services/authService.ts): `frontend/src/services/authService.ts`
- [Supervisor client](https://github.com/mamoud427/gestion_stagiaires/blob/master/frontend/src/services/encadreurService.ts): `frontend/src/services/encadreurService.ts`
- [Intern client](https://github.com/mamoud427/gestion_stagiaires/blob/master/frontend/src/services/stagiaireService.ts): `frontend/src/services/stagiaireService.ts`
- [Dashboard client](https://github.com/mamoud427/gestion_stagiaires/blob/master/frontend/src/services/dashboardService.ts): `frontend/src/services/dashboardService.ts`

### API and access

- [Express API](https://github.com/mamoud427/gestion_stagiaires/blob/master/backend/src/index.ts): `backend/src/index.ts`
- [JWT role guard](https://github.com/mamoud427/gestion_stagiaires/blob/master/backend/src/Middleware/auth.middleware.ts): `backend/src/Middleware/auth.middleware.ts`
- [Audit middleware](https://github.com/mamoud427/gestion_stagiaires/blob/master/backend/src/Middleware/audit.middleware.ts): `backend/src/Middleware/audit.middleware.ts`
- [Supervisor controller](https://github.com/mamoud427/gestion_stagiaires/blob/master/backend/src/controllers/Encadrant.controller.ts): `backend/src/controllers/Encadrant.controller.ts`
- [Intern controller](https://github.com/mamoud427/gestion_stagiaires/blob/master/backend/src/controllers/Stagiaire.controller.ts): `backend/src/controllers/Stagiaire.controller.ts`
- [Report controller](https://github.com/mamoud427/gestion_stagiaires/blob/master/backend/src/controllers/Rapport.controller.ts): `backend/src/controllers/Rapport.controller.ts`
- [Audit controller](https://github.com/mamoud427/gestion_stagiaires/blob/master/backend/src/controllers/Audit.controller.ts): `backend/src/controllers/Audit.controller.ts`

### Management services

- [Supervisor service](https://github.com/mamoud427/gestion_stagiaires/blob/master/backend/src/services/Encadrant.service.ts): `backend/src/services/Encadrant.service.ts`
- [Intern service](https://github.com/mamoud427/gestion_stagiaires/blob/master/backend/src/services/Stagiaire.sevice.ts): `backend/src/services/Stagiaire.sevice.ts`
- [Report service](https://github.com/mamoud427/gestion_stagiaires/blob/master/backend/src/services/Rapport.service.ts): `backend/src/services/Rapport.service.ts`
- [Audit log service](https://github.com/mamoud427/gestion_stagiaires/blob/master/backend/src/services/AuditLog.service.ts): `backend/src/services/AuditLog.service.ts`

### Persistence and files

- [Supervisor model](https://github.com/mamoud427/gestion_stagiaires/blob/master/backend/src/models/Encadrant.model.ts): `backend/src/models/Encadrant.model.ts`
- [Intern model](https://github.com/mamoud427/gestion_stagiaires/blob/master/backend/src/models/Stagiaire.model.ts): `backend/src/models/Stagiaire.model.ts`
- [Audit log model](https://github.com/mamoud427/gestion_stagiaires/blob/master/backend/src/models/AuditLog.model.ts): `backend/src/models/AuditLog.model.ts`
- [Report file storage](https://github.com/mamoud427/gestion_stagiaires/blob/master/backend/src/services/Pdf.service.ts): `backend/src/services/Pdf.service.ts`

### Other components

- **Staff user**
- **MongoDB**

## Connections

- Staff user → React app and routes: uses (evidence: `frontend/src/App.tsx`)
- React app and routes → Sign-in page: routes to (evidence: `frontend/src/App.tsx`)
- React app and routes → Supervisor management: routes to (evidence: `frontend/src/App.tsx`)
- React app and routes → Intern management: routes to (evidence: `frontend/src/App.tsx`)
- React app and routes → Dashboard: routes to (evidence: `frontend/src/App.tsx`)
- React app and routes → Reports page: routes to (evidence: `frontend/src/App.tsx`)
- Sign-in page → Authentication client: signs in via (evidence: `frontend/src/services/authService.ts`)
- Supervisor management → Supervisor client: manages supervisors (evidence: `frontend/src/pages/Encadreurs.tsx`)
- Intern management → Intern client: manages interns (evidence: `frontend/src/services/stagiaireService.ts`)
- Reports page → Report upload UI: renders (evidence: `frontend/src/pages/Rapports.tsx`)
- Authentication client → HTTP client: posts login (evidence: `frontend/src/services/authService.ts`)
- Supervisor client → HTTP client: sends requests (evidence: `frontend/src/services/encadreurService.ts`)
- Intern client → HTTP client: sends requests (evidence: `frontend/src/services/stagiaireService.ts`)
- Dashboard → Dashboard client: loads statistics (evidence: `frontend/src/pages/Dashboard.tsx`)
- Dashboard client → HTTP client: sends requests (evidence: `frontend/src/services/dashboardService.ts`)
- HTTP client → Express API: calls API
- Express API → Supervisor controller: routes requests
- Express API → Intern controller: routes requests
- Express API → Report controller: routes requests
- Supervisor controller → Supervisor service: delegates (evidence: `backend/src/controllers/Encadrant.controller.ts`)
- Intern controller → Intern service: delegates (evidence: `backend/src/controllers/Stagiaire.controller.ts`)
- Report controller → Report service: delegates (evidence: `backend/src/controllers/Rapport.controller.ts`)
- Supervisor service → Supervisor model: queries (evidence: `backend/src/services/Encadrant.service.ts`)
- Intern service → Intern model: queries (evidence: `backend/src/services/Stagiaire.sevice.ts`)
- Report service → Intern model: reads intern data (evidence: `backend/src/services/Rapport.service.ts`)
- Supervisor model → MongoDB: persists
- Intern model → MongoDB: persists
- Report service → Report file storage: stores and retrieves
- JWT role guard → Express API: guards routes
- Audit middleware → Audit log service: records activity (evidence: `backend/src/Middleware/audit.middleware.ts`)
- Audit log service → Audit log model: writes logs (evidence: `backend/src/services/AuditLog.service.ts`)
- Audit controller → Audit log service: reads logs (evidence: `backend/src/controllers/Audit.controller.ts`)
- Express API → Audit controller: routes audit query
- Audit log model → MongoDB: persists
