# mohamedyaakoubi/documed architecture

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

- Interactive diagram: https://gitdiagram.com/mohamedyaakoubi/documed
- Repository: https://github.com/mohamedyaakoubi/documed

## Overview

DocuMed is a doctor–patient healthcare management web application. Its main workflow is patient discovery and appointment booking, followed by doctor-side appointment and record management; patients can also review their dashboard and maintain profiles. The graph retains the documented authentication, clinic, and medical-record capabilities. Source excerpts show Firebase-backed role lookup, appointment discovery, and profile updates; several other capabilities are represented from README claims and the source tree, so their internal call paths are not asserted.

Main entry points: [`src/app`](https://github.com/mohamedyaakoubi/documed/tree/master/src/app) (Next.js routes), [`src/components/ClientDashboard.tsx`](https://github.com/mohamedyaakoubi/documed/blob/master/src/components/ClientDashboard.tsx) (Patient dashboard), [`src/components/docDashboard.tsx`](https://github.com/mohamedyaakoubi/documed/blob/master/src/components/docDashboard.tsx) (Doctor dashboard), [`src/lib/auth.ts`](https://github.com/mohamedyaakoubi/documed/blob/master/src/lib/auth.ts) (Authentication)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User experience"]
  node_web["Next.js routes"]
  node_home["Home and discovery<br/>[Home.tsx]"]
end

subgraph group_care["Care workflows"]
  node_clientdash["Patient dashboard"]
  node_doctorview["Doctor dashboard<br/>[docDashboard.tsx]"]
  node_booking["Appointment booking"]
  node_appointments["Appointment management<br/>[Appointments.tsx]"]
  node_records["Medical records<br/>[DocInsertion.tsx]"]
  node_patientrecord["Patient history<br/>[PatientRecord.tsx]"]
  node_clinicdata["Clinic and specialty data<br/>[constants.ts]"]
end

subgraph group_identity["Identity and profiles"]
  node_doctorprofile["Doctor profile<br/>[DoctorParams.tsx]"]
  node_patientprofile["Patient profile<br/>[ClientParams.tsx]"]
  node_registration["Account registration<br/>[ClientSignUp.tsx]"]
  node_login["Authentication<br/>[auth.ts]"]
  node_usercontext["Role and user context<br/>[UserContext.tsx]"]
end

subgraph group_platform["Application platform"]
  node_firebase["Firebase clients<br/>[firebase.ts]"]
  node_firestore[("Firestore")]
  node_authservice["Firebase Authentication"]
  node_validations["Form validation<br/>[clientSchema.ts]"]
end

node_patients(("Patients"))
node_doctors(("Doctors"))

node_patients -->|"uses"| node_web
node_doctors -->|"uses"| node_web
node_web -->|"renders"| node_home
node_web -->|"renders"| node_clientdash
node_web -->|"renders"| node_doctorview
node_web -->|"renders"| node_booking
node_web -->|"renders"| node_records
node_web -.->|"renders"| node_patientrecord
node_web -.->|"renders"| node_appointments
node_patients -.->|"discovers care"| node_home
node_patients -.->|"requests appointment"| node_booking
node_doctors -.->|"manages care"| node_doctorview
node_doctorview -.->|"manages"| node_appointments
node_doctorview -.->|"maintains"| node_records
node_patients -.->|"views history"| node_clientdash
node_clientdash -->|"reads appointments and clinics"| node_firestore
node_clientdash -->|"reads user role"| node_usercontext
node_booking -.->|"schedules"| node_firestore
node_records -.->|"stores records"| node_firestore
node_patientrecord -.->|"reads history"| node_firestore
node_patients -.->|"registers"| node_registration
node_registration -->|"creates account"| node_authservice
node_patients -.->|"signs in"| node_login
node_doctors -.->|"signs in"| node_login
node_login -->|"authenticates"| node_authservice
node_login -->|"looks up roles"| node_firestore
node_usercontext -->|"queries role profiles"| node_firestore
node_patientprofile -->|"updates profile"| node_firestore
node_doctors -.->|"updates profile"| node_doctorprofile
node_doctorprofile -.->|"updates profile"| node_firestore
node_firebase -->|"initializes"| node_authservice
node_firebase -->|"initializes"| node_firestore
node_home -->|"uses catalog"| node_clinicdata
node_registration -.->|"validates form"| node_validations
node_patientprofile -.->|"validates form"| node_validations

click node_web "https://github.com/mohamedyaakoubi/documed/tree/master/src/app"
click node_home "https://github.com/mohamedyaakoubi/documed/blob/master/src/components/Home.tsx"
click node_clientdash "https://github.com/mohamedyaakoubi/documed/blob/master/src/components/ClientDashboard.tsx"
click node_doctorview "https://github.com/mohamedyaakoubi/documed/blob/master/src/components/docDashboard.tsx"
click node_booking "https://github.com/mohamedyaakoubi/documed/blob/master/src/components/MakeAppointment.tsx"
click node_appointments "https://github.com/mohamedyaakoubi/documed/blob/master/src/components/Appointments.tsx"
click node_records "https://github.com/mohamedyaakoubi/documed/blob/master/src/components/DocInsertion.tsx"
click node_patientrecord "https://github.com/mohamedyaakoubi/documed/blob/master/src/components/PatientRecord.tsx"
click node_doctorprofile "https://github.com/mohamedyaakoubi/documed/blob/master/src/components/DoctorParams.tsx"
click node_patientprofile "https://github.com/mohamedyaakoubi/documed/blob/master/src/components/ClientParams.tsx"
click node_registration "https://github.com/mohamedyaakoubi/documed/blob/master/src/components/ClientSignUp.tsx"
click node_login "https://github.com/mohamedyaakoubi/documed/blob/master/src/lib/auth.ts"
click node_usercontext "https://github.com/mohamedyaakoubi/documed/blob/master/src/contexts/UserContext.tsx"
click node_firebase "https://github.com/mohamedyaakoubi/documed/blob/master/src/lib/firebase.ts"
click node_clinicdata "https://github.com/mohamedyaakoubi/documed/blob/master/src/lib/constants.ts"
click node_validations "https://github.com/mohamedyaakoubi/documed/blob/master/src/lib/validation/clientSchema.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_web,node_home toneBlue
class node_clientdash,node_doctorview,node_booking,node_appointments,node_records,node_patientrecord,node_clinicdata toneAmber
class node_doctorprofile,node_patientprofile,node_registration,node_login,node_usercontext toneMint
class node_firebase,node_firestore,node_authservice,node_validations toneRose
class node_patients,node_doctors toneIndigo
```

## Components

### User experience

- [Next.js routes](https://github.com/mohamedyaakoubi/documed/tree/master/src/app): `src/app`
- [Home and discovery](https://github.com/mohamedyaakoubi/documed/blob/master/src/components/Home.tsx): `src/components/Home.tsx`

### Care workflows

- [Patient dashboard](https://github.com/mohamedyaakoubi/documed/blob/master/src/components/ClientDashboard.tsx): `src/components/ClientDashboard.tsx`
- [Doctor dashboard](https://github.com/mohamedyaakoubi/documed/blob/master/src/components/docDashboard.tsx): `src/components/docDashboard.tsx`
- [Appointment booking](https://github.com/mohamedyaakoubi/documed/blob/master/src/components/MakeAppointment.tsx): `src/components/MakeAppointment.tsx`
- [Appointment management](https://github.com/mohamedyaakoubi/documed/blob/master/src/components/Appointments.tsx): `src/components/Appointments.tsx`
- [Medical records](https://github.com/mohamedyaakoubi/documed/blob/master/src/components/DocInsertion.tsx): `src/components/DocInsertion.tsx`
- [Patient history](https://github.com/mohamedyaakoubi/documed/blob/master/src/components/PatientRecord.tsx): `src/components/PatientRecord.tsx`
- [Clinic and specialty data](https://github.com/mohamedyaakoubi/documed/blob/master/src/lib/constants.ts): `src/lib/constants.ts`

### Identity and profiles

- [Doctor profile](https://github.com/mohamedyaakoubi/documed/blob/master/src/components/DoctorParams.tsx): `src/components/DoctorParams.tsx`
- [Patient profile](https://github.com/mohamedyaakoubi/documed/blob/master/src/components/ClientParams.tsx): `src/components/ClientParams.tsx`
- [Account registration](https://github.com/mohamedyaakoubi/documed/blob/master/src/components/ClientSignUp.tsx): `src/components/ClientSignUp.tsx`
- [Authentication](https://github.com/mohamedyaakoubi/documed/blob/master/src/lib/auth.ts): `src/lib/auth.ts`
- [Role and user context](https://github.com/mohamedyaakoubi/documed/blob/master/src/contexts/UserContext.tsx): `src/contexts/UserContext.tsx`

### Application platform

- [Firebase clients](https://github.com/mohamedyaakoubi/documed/blob/master/src/lib/firebase.ts): `src/lib/firebase.ts`
- **Firestore**
- **Firebase Authentication**
- [Form validation](https://github.com/mohamedyaakoubi/documed/blob/master/src/lib/validation/clientSchema.ts): `src/lib/validation/clientSchema.ts`

### Other components

- **Patients**
- **Doctors**

## Connections

- Patients → Next.js routes: uses (evidence: `README.md`)
- Doctors → Next.js routes: uses (evidence: `README.md`)
- Next.js routes → Home and discovery: renders (evidence: `src/app/page.tsx`)
- Next.js routes → Patient dashboard: renders (evidence: `src/app/client-dashboard/page.tsx`)
- Next.js routes → Doctor dashboard: renders (evidence: `src/app/doc-dashboard/page.tsx`)
- Next.js routes → Appointment booking: renders (evidence: `src/app/make-appointment/page.tsx`)
- Next.js routes → Medical records: renders (evidence: `src/app/doc-insertion/page.tsx`)
- Next.js routes → Patient history: renders
- Next.js routes → Appointment management: renders
- Patients → Home and discovery: discovers care
- Patients → Appointment booking: requests appointment
- Doctors → Doctor dashboard: manages care
- Doctor dashboard → Appointment management: manages
- Doctor dashboard → Medical records: maintains
- Patients → Patient dashboard: views history
- Patient dashboard → Firestore: reads appointments and clinics (evidence: `src/components/ClientDashboard.tsx`)
- Patient dashboard → Role and user context: reads user role (evidence: `src/components/ClientDashboard.tsx`)
- Appointment booking → Firestore: schedules
- Medical records → Firestore: stores records
- Patient history → Firestore: reads history
- Patients → Account registration: registers
- Account registration → Firebase Authentication: creates account (evidence: `src/components/ClientSignUp.tsx`)
- Patients → Authentication: signs in
- Doctors → Authentication: signs in
- Authentication → Firebase Authentication: authenticates (evidence: `src/lib/auth.ts`)
- Authentication → Firestore: looks up roles (evidence: `src/lib/auth.ts`)
- Role and user context → Firestore: queries role profiles (evidence: `src/contexts/UserContext.tsx`)
- Patient profile → Firestore: updates profile (evidence: `src/components/ClientParams.tsx`)
- Doctors → Doctor profile: updates profile
- Doctor profile → Firestore: updates profile
- Firebase clients → Firebase Authentication: initializes (evidence: `src/lib/firebase.ts`)
- Firebase clients → Firestore: initializes (evidence: `src/lib/firebase.ts`)
- Home and discovery → Clinic and specialty data: uses catalog (evidence: `src/components/Home.tsx`)
- Account registration → Form validation: validates form (evidence: `src/components/ClientSignUp.tsx`)
- Patient profile → Form validation: validates form (evidence: `src/components/ClientParams.tsx`)
