# thaemine92/stageagentai architecture

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

- Interactive diagram: https://gitdiagram.com/thaemine92/stageagentai
- Repository: https://github.com/thaemine92/stageagentai

## Overview

Agent de rendez-vous IA combines a professional/patient web portal with an Express API and SQLite persistence. Users enter through the React application; professionals manage patients and appointments, while patients use their space and the conversational assistant can interpret appointment requests and invoke appointment or patient operations. The README also describes triage, multichannel access, privacy, reminders, analytics and operational logging; some of these capabilities have no sampled implementation, so they are shown as documented subsystems without speculative call paths. Edges reflect shown imports/calls or README claims.

Main entry points: [`src/server.ts`](https://github.com/thaemine92/stageagentai/blob/main/src/server.ts) (Express server), [`src/App.tsx`](https://github.com/thaemine92/stageagentai/blob/main/src/App.tsx) (React app and routes), [`src/controllers/aiController.ts`](https://github.com/thaemine92/stageagentai/blob/main/src/controllers/aiController.ts) (Conversational agent), [`src/database/db.ts`](https://github.com/thaemine92/stageagentai/blob/main/src/database/db.ts) (SQLite database)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_app["React app and routes<br/>[App.tsx]"]
  node_auth_pages["Sign-in and registration"]
  node_professional_pages["Professional dashboard<br/>[DashboardPage.tsx]"]
  node_patient_pages["Patient management<br/>[PatientsPage.tsx]"]
  node_patient_space["Patient space"]
  node_chat_ui["Chat interface<br/>[Chatbot.tsx]"]
  node_client_hook["Client observer hook<br/>[UseClients.tsx]"]
  node_client_observer["Client observer store<br/>[ClientObserver.tsx]"]
end

subgraph group_api["API and workflows"]
  node_server["Express server<br/>[server.ts]"]
  node_auth_routes["Authentication routes<br/>[authRoutes.ts]"]
  node_client_routes["Client routes<br/>[clientRoutes.ts]"]
  node_appointment_routes["Appointment routes"]
  node_ai_routes["AI routes<br/>[aiRoutes.ts]"]
  node_service_routes["Service routes<br/>[serviceRoutes.ts]"]
  node_auth_controller["Account and recovery<br/>[authController.ts]"]
end

subgraph group_domain["Scheduling domain"]
  node_client_controller["Patient records"]
  node_appointment_controller["Appointment operations"]
  node_ai_controller["Conversational agent<br/>[aiController.ts]"]
  node_service_controller["Service catalog"]
  node_client_model["Client domain<br/>[Clients.ts]"]
  node_appointment_model["Appointment domain<br/>[RendezVous.ts]"]
  node_professional_model["Professional account"]
  node_agent_config["Agent configuration"]
  node_service_model["Service reference"]
end

subgraph group_data["Persistence and monitoring"]
  node_system_log["Interaction and error logs<br/>[LogSysteme.ts]"]
  node_sqlite[("SQLite database<br/>[db.ts]")]
  node_db_init["Schema initialization<br/>[initDb.ts]"]
end

subgraph group_integrations["External services"]
  node_mistral{{"Mistral AI API"}}
  node_channels{{"Phone, SMS, WhatsApp"}}
end

node_user(("Professional or patient"))

node_user -->|"uses"| node_app
node_app -->|"routes to"| node_auth_pages
node_app -->|"routes to"| node_professional_pages
node_app -->|"routes to"| node_patient_pages
node_app -->|"routes to"| node_patient_space
node_app -->|"renders"| node_chat_ui
node_client_hook -->|"subscribes to"| node_client_observer
node_server -->|"mounts"| node_auth_routes
node_server -->|"mounts"| node_client_routes
node_server -->|"mounts"| node_appointment_routes
node_server -->|"mounts"| node_ai_routes
node_server -->|"mounts"| node_service_routes
node_server -->|"initializes"| node_sqlite
node_server -->|"runs initialization"| node_db_init
node_auth_routes -->|"dispatches to"| node_auth_controller
node_client_routes -->|"dispatches to"| node_client_controller
node_appointment_routes -->|"dispatches to"| node_appointment_controller
node_ai_routes -->|"dispatches to"| node_ai_controller
node_service_routes -->|"dispatches to"| node_service_controller
node_auth_controller -->|"queries"| node_sqlite
node_client_controller -->|"queries"| node_sqlite
node_appointment_controller -->|"reads and writes"| node_sqlite
node_ai_controller -->|"invokes operations"| node_appointment_controller
node_ai_controller -->|"invokes operations"| node_client_controller
node_ai_controller -->|"requests completions"| node_mistral
node_ai_controller -->|"uses configuration"| node_agent_config
node_appointment_controller -->|"handles records"| node_appointment_model
node_client_controller -->|"handles records"| node_client_model
node_auth_controller -->|"uses account type"| node_professional_model
node_db_init -->|"creates schema"| node_sqlite
node_channels -.->|"supports access"| node_ai_controller

click node_app "https://github.com/thaemine92/stageagentai/blob/main/src/App.tsx"
click node_auth_pages "https://github.com/thaemine92/stageagentai/tree/main/src/pages"
click node_professional_pages "https://github.com/thaemine92/stageagentai/blob/main/src/pages/DashboardPage.tsx"
click node_patient_pages "https://github.com/thaemine92/stageagentai/blob/main/src/pages/PatientsPage.tsx"
click node_patient_space "https://github.com/thaemine92/stageagentai/blob/main/src/pages/PatientSpacePage.tsx"
click node_chat_ui "https://github.com/thaemine92/stageagentai/blob/main/src/components/Chatbot.tsx"
click node_client_hook "https://github.com/thaemine92/stageagentai/blob/main/src/hooks/UseClients.tsx"
click node_client_observer "https://github.com/thaemine92/stageagentai/blob/main/src/models/ClientObserver.tsx"
click node_server "https://github.com/thaemine92/stageagentai/blob/main/src/server.ts"
click node_auth_routes "https://github.com/thaemine92/stageagentai/blob/main/src/routes/authRoutes.ts"
click node_client_routes "https://github.com/thaemine92/stageagentai/blob/main/src/routes/clientRoutes.ts"
click node_appointment_routes "https://github.com/thaemine92/stageagentai/blob/main/src/routes/appointmentRoutes.ts"
click node_ai_routes "https://github.com/thaemine92/stageagentai/blob/main/src/routes/aiRoutes.ts"
click node_service_routes "https://github.com/thaemine92/stageagentai/blob/main/src/routes/serviceRoutes.ts"
click node_auth_controller "https://github.com/thaemine92/stageagentai/blob/main/src/controllers/authController.ts"
click node_client_controller "https://github.com/thaemine92/stageagentai/blob/main/src/controllers/clientController.ts"
click node_appointment_controller "https://github.com/thaemine92/stageagentai/blob/main/src/controllers/appointmentController.ts"
click node_ai_controller "https://github.com/thaemine92/stageagentai/blob/main/src/controllers/aiController.ts"
click node_service_controller "https://github.com/thaemine92/stageagentai/blob/main/src/controllers/serviceController.ts"
click node_client_model "https://github.com/thaemine92/stageagentai/blob/main/src/models/Clients.ts"
click node_appointment_model "https://github.com/thaemine92/stageagentai/blob/main/src/models/RendezVous.ts"
click node_professional_model "https://github.com/thaemine92/stageagentai/blob/main/src/models/CompteProfessionnel.ts"
click node_agent_config "https://github.com/thaemine92/stageagentai/blob/main/src/models/ConfigurationAgentAI.ts"
click node_service_model "https://github.com/thaemine92/stageagentai/blob/main/src/models/ReferentielServices.ts"
click node_system_log "https://github.com/thaemine92/stageagentai/blob/main/src/models/LogSysteme.ts"
click node_sqlite "https://github.com/thaemine92/stageagentai/blob/main/src/database/db.ts"
click node_db_init "https://github.com/thaemine92/stageagentai/blob/main/src/database/initDb.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_auth_pages,node_professional_pages,node_patient_pages,node_patient_space,node_chat_ui,node_client_hook,node_client_observer toneBlue
class node_server,node_auth_routes,node_client_routes,node_appointment_routes,node_ai_routes,node_service_routes,node_auth_controller toneAmber
class node_client_controller,node_appointment_controller,node_ai_controller,node_service_controller,node_client_model,node_appointment_model,node_professional_model,node_agent_config,node_service_model toneMint
class node_system_log,node_sqlite,node_db_init toneRose
class node_mistral,node_channels,node_user toneIndigo
```

## Components

### Web application

- [React app and routes](https://github.com/thaemine92/stageagentai/blob/main/src/App.tsx): `src/App.tsx`
- [Sign-in and registration](https://github.com/thaemine92/stageagentai/tree/main/src/pages): `src/pages`
- [Professional dashboard](https://github.com/thaemine92/stageagentai/blob/main/src/pages/DashboardPage.tsx): `src/pages/DashboardPage.tsx`
- [Patient management](https://github.com/thaemine92/stageagentai/blob/main/src/pages/PatientsPage.tsx): `src/pages/PatientsPage.tsx`
- [Patient space](https://github.com/thaemine92/stageagentai/blob/main/src/pages/PatientSpacePage.tsx): `src/pages/PatientSpacePage.tsx`
- [Chat interface](https://github.com/thaemine92/stageagentai/blob/main/src/components/Chatbot.tsx): `src/components/Chatbot.tsx`
- [Client observer hook](https://github.com/thaemine92/stageagentai/blob/main/src/hooks/UseClients.tsx): `src/hooks/UseClients.tsx`
- [Client observer store](https://github.com/thaemine92/stageagentai/blob/main/src/models/ClientObserver.tsx): `src/models/ClientObserver.tsx`

### API and workflows

- [Express server](https://github.com/thaemine92/stageagentai/blob/main/src/server.ts): `src/server.ts`
- [Authentication routes](https://github.com/thaemine92/stageagentai/blob/main/src/routes/authRoutes.ts): `src/routes/authRoutes.ts`
- [Client routes](https://github.com/thaemine92/stageagentai/blob/main/src/routes/clientRoutes.ts): `src/routes/clientRoutes.ts`
- [Appointment routes](https://github.com/thaemine92/stageagentai/blob/main/src/routes/appointmentRoutes.ts): `src/routes/appointmentRoutes.ts`
- [AI routes](https://github.com/thaemine92/stageagentai/blob/main/src/routes/aiRoutes.ts): `src/routes/aiRoutes.ts`
- [Service routes](https://github.com/thaemine92/stageagentai/blob/main/src/routes/serviceRoutes.ts): `src/routes/serviceRoutes.ts`
- [Account and recovery](https://github.com/thaemine92/stageagentai/blob/main/src/controllers/authController.ts): `src/controllers/authController.ts`

### Scheduling domain

- [Patient records](https://github.com/thaemine92/stageagentai/blob/main/src/controllers/clientController.ts): `src/controllers/clientController.ts`
- [Appointment operations](https://github.com/thaemine92/stageagentai/blob/main/src/controllers/appointmentController.ts): `src/controllers/appointmentController.ts`
- [Conversational agent](https://github.com/thaemine92/stageagentai/blob/main/src/controllers/aiController.ts): `src/controllers/aiController.ts`
- [Service catalog](https://github.com/thaemine92/stageagentai/blob/main/src/controllers/serviceController.ts): `src/controllers/serviceController.ts`
- [Client domain](https://github.com/thaemine92/stageagentai/blob/main/src/models/Clients.ts): `src/models/Clients.ts`
- [Appointment domain](https://github.com/thaemine92/stageagentai/blob/main/src/models/RendezVous.ts): `src/models/RendezVous.ts`
- [Professional account](https://github.com/thaemine92/stageagentai/blob/main/src/models/CompteProfessionnel.ts): `src/models/CompteProfessionnel.ts`
- [Agent configuration](https://github.com/thaemine92/stageagentai/blob/main/src/models/ConfigurationAgentAI.ts): `src/models/ConfigurationAgentAI.ts`
- [Service reference](https://github.com/thaemine92/stageagentai/blob/main/src/models/ReferentielServices.ts): `src/models/ReferentielServices.ts`

### Persistence and monitoring

- [Interaction and error logs](https://github.com/thaemine92/stageagentai/blob/main/src/models/LogSysteme.ts): `src/models/LogSysteme.ts`
- [SQLite database](https://github.com/thaemine92/stageagentai/blob/main/src/database/db.ts): `src/database/db.ts`
- [Schema initialization](https://github.com/thaemine92/stageagentai/blob/main/src/database/initDb.ts): `src/database/initDb.ts`

### External services

- **Mistral AI API**
- **Phone, SMS, WhatsApp**

### Other components

- **Professional or patient**

## Connections

- Professional or patient → React app and routes: uses (evidence: `src/App.tsx`)
- React app and routes → Sign-in and registration: routes to (evidence: `src/App.tsx`)
- React app and routes → Professional dashboard: routes to (evidence: `src/App.tsx`)
- React app and routes → Patient management: routes to (evidence: `src/App.tsx`)
- React app and routes → Patient space: routes to (evidence: `src/App.tsx`)
- React app and routes → Chat interface: renders (evidence: `src/App.tsx`)
- Client observer hook → Client observer store: subscribes to (evidence: `src/hooks/UseClients.tsx`)
- Express server → Authentication routes: mounts (evidence: `src/server.ts`)
- Express server → Client routes: mounts (evidence: `src/server.ts`)
- Express server → Appointment routes: mounts (evidence: `src/server.ts`)
- Express server → AI routes: mounts (evidence: `src/server.ts`)
- Express server → Service routes: mounts (evidence: `src/server.ts`)
- Express server → SQLite database: initializes (evidence: `src/server.ts`)
- Express server → Schema initialization: runs initialization (evidence: `src/server.ts`)
- Authentication routes → Account and recovery: dispatches to (evidence: `src/routes/authRoutes.ts`)
- Client routes → Patient records: dispatches to (evidence: `src/routes/clientRoutes.ts`)
- Appointment routes → Appointment operations: dispatches to (evidence: `src/routes/appointmentRoutes.ts`)
- AI routes → Conversational agent: dispatches to (evidence: `src/routes/aiRoutes.ts`)
- Service routes → Service catalog: dispatches to (evidence: `src/routes/serviceRoutes.ts`)
- Account and recovery → SQLite database: queries (evidence: `src/controllers/authController.ts`)
- Patient records → SQLite database: queries (evidence: `src/controllers/clientController.ts`)
- Appointment operations → SQLite database: reads and writes (evidence: `src/controllers/appointmentController.ts`)
- Conversational agent → Appointment operations: invokes operations (evidence: `src/controllers/aiController.ts`)
- Conversational agent → Patient records: invokes operations (evidence: `src/controllers/aiController.ts`)
- Conversational agent → Mistral AI API: requests completions (evidence: `src/controllers/aiController.ts`)
- Conversational agent → Agent configuration: uses configuration (evidence: `src/controllers/aiController.ts`)
- Appointment operations → Appointment domain: handles records (evidence: `src/controllers/appointmentController.ts`)
- Patient records → Client domain: handles records (evidence: `src/controllers/clientController.ts`)
- Account and recovery → Professional account: uses account type (evidence: `src/controllers/authController.ts`)
- Schema initialization → SQLite database: creates schema (evidence: `src/database/initDb.ts`)
- Phone, SMS, WhatsApp → Conversational agent: supports access
