# 1younesalloui/medibook architecture

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

- Interactive diagram: https://gitdiagram.com/1younesalloui/medibook
- Repository: https://github.com/1younesalloui/medibook

## Overview

This is a role-based medical appointment booking system. Patients register or sign in, find doctors, and request appointments; doctors and assistants manage schedules and requests, while doctors record consultations. Administrators have account-management and system-overview capabilities. The frontend routes users to role-oriented pages and sends requests through a shared API client to a Django REST API, whose domain views, serializers, and models implement identity, doctors, appointments, and clinical records. PDF consultation output is documented by the backend tree, though its exact invocation is not established by the excerpts.

Main entry points: [`frontend/src/App.jsx`](https://github.com/1younesalloui/medibook/blob/main/frontend/src/App.jsx) (Application routes), [`frontend/src/services/api.js`](https://github.com/1younesalloui/medibook/blob/main/frontend/src/services/api.js) (HTTP API client), [`backend/core/urls.py`](https://github.com/1younesalloui/medibook/blob/main/backend/core/urls.py) (Django REST API), [`backend/users/views.py`](https://github.com/1younesalloui/medibook/blob/main/backend/users/views.py) (User API views)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Frontend experience"]
  node_app["Application routes<br/>[App.jsx]"]
  node_dashboard["Role dashboards<br/>[Dashboard.jsx]"]
  node_doctor_search["Doctor search<br/>[DoctorsList.jsx]"]
  node_doctor_profile["Doctor profile<br/>[DoctorProfile.jsx]"]
  node_my_profile["Practice profile"]
  node_appointments_ui["Appointment management<br/>[Appointments.jsx]"]
  node_consultations_ui["Consultation pages<br/>[Consultations.jsx]"]
  node_consultation_form["Consultation form"]
  node_api_client["HTTP API client<br/>[api.js]"]
end

subgraph group_identity["Identity and access"]
  node_auth_ui["Authentication context<br/>[AuthContext.jsx]"]
  node_auth_views["User API views<br/>[views.py]"]
  node_user_serializers["User serializers<br/>[serializers.py]"]
  node_user_models[("User and patient<br/>[models.py]")]
  node_permissions["Role permissions<br/>[permissions.py]"]
end

subgraph group_directory["Doctor directory"]
  node_doctor_views["Doctor API views<br/>[views.py]"]
  node_doctor_serializers["Doctor serializers<br/>[serializers.py]"]
  node_doctor_models[("Doctor availability<br/>[models.py]")]
end

subgraph group_appointments["Appointments"]
  node_appointment_views["Appointment API views<br/>[views.py]"]
  node_appointment_serializers["Booking validation<br/>[serializers.py]"]
  node_appointment_models[("Appointment records<br/>[models.py]")]
end

subgraph group_clinical["Clinical records"]
  node_consultation_views["Consultation API views<br/>[views.py]"]
  node_consultation_serializers["Consultation serializers<br/>[serializers.py]"]
  node_consultation_models[("Consultation records<br/>[models.py]")]
  node_pdf["Consultation PDF output<br/>[pdf_generator.py]"]
end

node_user(("Patient, doctor, admin"))
node_backend_api["Django REST API<br/>[urls.py]"]

node_user -->|"uses"| node_app
node_app -->|"provides auth"| node_auth_ui
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_doctor_search
node_app -->|"routes to"| node_doctor_profile
node_app -->|"routes to"| node_my_profile
node_app -->|"routes to"| node_appointments_ui
node_app -->|"routes to"| node_consultations_ui
node_auth_ui -->|"requests identity"| node_api_client
node_dashboard -->|"loads dashboard data"| node_api_client
node_doctor_search -->|"searches doctors"| node_api_client
node_doctor_profile -->|"loads profile"| node_api_client
node_my_profile -->|"updates profile"| node_api_client
node_appointments_ui -->|"manages bookings"| node_api_client
node_consultations_ui -->|"loads records"| node_api_client
node_appointments_ui -->|"opens form"| node_consultation_form
node_consultations_ui -->|"opens form"| node_consultation_form
node_consultation_form -->|"saves consultation"| node_api_client
node_api_client -->|"calls API"| node_backend_api
node_backend_api -.->|"routes identity"| node_auth_views
node_backend_api -.->|"routes doctors"| node_doctor_views
node_backend_api -.->|"routes appointments"| node_appointment_views
node_backend_api -.->|"routes consultations"| node_consultation_views
node_auth_views -->|"serializes users"| node_user_serializers
node_auth_views -->|"reads user data"| node_user_models
node_auth_views -->|"checks roles"| node_permissions
node_user_serializers -->|"creates profiles"| node_user_models
node_doctor_views -->|"serializes doctors"| node_doctor_serializers
node_doctor_views -->|"reads availability"| node_doctor_models
node_doctor_views -->|"checks roles"| node_permissions
node_doctor_serializers -->|"serializes availability"| node_doctor_models
node_appointment_views -->|"validates requests"| node_appointment_serializers
node_appointment_views -->|"manages records"| node_appointment_models
node_appointment_serializers -->|"checks conflicts"| node_appointment_models
node_appointment_serializers -->|"embeds doctor data"| node_doctor_serializers
node_appointment_serializers -->|"embeds patient data"| node_user_serializers
node_consultation_views -->|"serializes records"| node_consultation_serializers
node_consultation_views -->|"manages records"| node_consultation_models
node_consultation_views -->|"checks access"| node_permissions
node_consultation_serializers -->|"serializes records"| node_consultation_models

click node_app "https://github.com/1younesalloui/medibook/blob/main/frontend/src/App.jsx"
click node_dashboard "https://github.com/1younesalloui/medibook/blob/main/frontend/src/pages/Dashboard.jsx"
click node_doctor_search "https://github.com/1younesalloui/medibook/blob/main/frontend/src/pages/DoctorsList.jsx"
click node_doctor_profile "https://github.com/1younesalloui/medibook/blob/main/frontend/src/pages/DoctorProfile.jsx"
click node_my_profile "https://github.com/1younesalloui/medibook/blob/main/frontend/src/pages/DoctorMyProfile.jsx"
click node_appointments_ui "https://github.com/1younesalloui/medibook/blob/main/frontend/src/pages/Appointments.jsx"
click node_consultations_ui "https://github.com/1younesalloui/medibook/blob/main/frontend/src/pages/Consultations.jsx"
click node_consultation_form "https://github.com/1younesalloui/medibook/blob/main/frontend/src/components/ConsultationForm.jsx"
click node_api_client "https://github.com/1younesalloui/medibook/blob/main/frontend/src/services/api.js"
click node_auth_ui "https://github.com/1younesalloui/medibook/blob/main/frontend/src/context/AuthContext.jsx"
click node_auth_views "https://github.com/1younesalloui/medibook/blob/main/backend/users/views.py"
click node_user_serializers "https://github.com/1younesalloui/medibook/blob/main/backend/users/serializers.py"
click node_user_models "https://github.com/1younesalloui/medibook/blob/main/backend/users/models.py"
click node_permissions "https://github.com/1younesalloui/medibook/blob/main/backend/core/permissions.py"
click node_doctor_views "https://github.com/1younesalloui/medibook/blob/main/backend/doctors/views.py"
click node_doctor_serializers "https://github.com/1younesalloui/medibook/blob/main/backend/doctors/serializers.py"
click node_doctor_models "https://github.com/1younesalloui/medibook/blob/main/backend/doctors/models.py"
click node_appointment_views "https://github.com/1younesalloui/medibook/blob/main/backend/appointments/views.py"
click node_appointment_serializers "https://github.com/1younesalloui/medibook/blob/main/backend/appointments/serializers.py"
click node_appointment_models "https://github.com/1younesalloui/medibook/blob/main/backend/appointments/models.py"
click node_consultation_views "https://github.com/1younesalloui/medibook/blob/main/backend/consultations/views.py"
click node_consultation_serializers "https://github.com/1younesalloui/medibook/blob/main/backend/consultations/serializers.py"
click node_consultation_models "https://github.com/1younesalloui/medibook/blob/main/backend/consultations/models.py"
click node_pdf "https://github.com/1younesalloui/medibook/blob/main/backend/consultations/pdf_generator.py"
click node_backend_api "https://github.com/1younesalloui/medibook/blob/main/backend/core/urls.py"

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_dashboard,node_doctor_search,node_doctor_profile,node_my_profile,node_appointments_ui,node_consultations_ui,node_consultation_form,node_api_client toneBlue
class node_auth_ui,node_auth_views,node_user_serializers,node_user_models,node_permissions toneAmber
class node_doctor_views,node_doctor_serializers,node_doctor_models,node_backend_api toneMint
class node_appointment_views,node_appointment_serializers,node_appointment_models toneRose
class node_consultation_views,node_consultation_serializers,node_consultation_models,node_pdf,node_user toneIndigo
```

## Components

### Frontend experience

- [Application routes](https://github.com/1younesalloui/medibook/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Role dashboards](https://github.com/1younesalloui/medibook/blob/main/frontend/src/pages/Dashboard.jsx): `frontend/src/pages/Dashboard.jsx`
- [Doctor search](https://github.com/1younesalloui/medibook/blob/main/frontend/src/pages/DoctorsList.jsx): `frontend/src/pages/DoctorsList.jsx`
- [Doctor profile](https://github.com/1younesalloui/medibook/blob/main/frontend/src/pages/DoctorProfile.jsx): `frontend/src/pages/DoctorProfile.jsx`
- [Practice profile](https://github.com/1younesalloui/medibook/blob/main/frontend/src/pages/DoctorMyProfile.jsx): `frontend/src/pages/DoctorMyProfile.jsx`
- [Appointment management](https://github.com/1younesalloui/medibook/blob/main/frontend/src/pages/Appointments.jsx): `frontend/src/pages/Appointments.jsx`
- [Consultation pages](https://github.com/1younesalloui/medibook/blob/main/frontend/src/pages/Consultations.jsx): `frontend/src/pages/Consultations.jsx`
- [Consultation form](https://github.com/1younesalloui/medibook/blob/main/frontend/src/components/ConsultationForm.jsx): `frontend/src/components/ConsultationForm.jsx`
- [HTTP API client](https://github.com/1younesalloui/medibook/blob/main/frontend/src/services/api.js): `frontend/src/services/api.js`

### Identity and access

- [Authentication context](https://github.com/1younesalloui/medibook/blob/main/frontend/src/context/AuthContext.jsx): `frontend/src/context/AuthContext.jsx`
- [User API views](https://github.com/1younesalloui/medibook/blob/main/backend/users/views.py): `backend/users/views.py`
- [User serializers](https://github.com/1younesalloui/medibook/blob/main/backend/users/serializers.py): `backend/users/serializers.py`
- [User and patient](https://github.com/1younesalloui/medibook/blob/main/backend/users/models.py): `backend/users/models.py`
- [Role permissions](https://github.com/1younesalloui/medibook/blob/main/backend/core/permissions.py): `backend/core/permissions.py`

### Doctor directory

- [Doctor API views](https://github.com/1younesalloui/medibook/blob/main/backend/doctors/views.py): `backend/doctors/views.py`
- [Doctor serializers](https://github.com/1younesalloui/medibook/blob/main/backend/doctors/serializers.py): `backend/doctors/serializers.py`
- [Doctor availability](https://github.com/1younesalloui/medibook/blob/main/backend/doctors/models.py): `backend/doctors/models.py`

### Appointments

- [Appointment API views](https://github.com/1younesalloui/medibook/blob/main/backend/appointments/views.py): `backend/appointments/views.py`
- [Booking validation](https://github.com/1younesalloui/medibook/blob/main/backend/appointments/serializers.py): `backend/appointments/serializers.py`
- [Appointment records](https://github.com/1younesalloui/medibook/blob/main/backend/appointments/models.py): `backend/appointments/models.py`

### Clinical records

- [Consultation API views](https://github.com/1younesalloui/medibook/blob/main/backend/consultations/views.py): `backend/consultations/views.py`
- [Consultation serializers](https://github.com/1younesalloui/medibook/blob/main/backend/consultations/serializers.py): `backend/consultations/serializers.py`
- [Consultation records](https://github.com/1younesalloui/medibook/blob/main/backend/consultations/models.py): `backend/consultations/models.py`
- [Consultation PDF output](https://github.com/1younesalloui/medibook/blob/main/backend/consultations/pdf_generator.py): `backend/consultations/pdf_generator.py`

### Other components

- **Patient, doctor, admin**
- [Django REST API](https://github.com/1younesalloui/medibook/blob/main/backend/core/urls.py): `backend/core/urls.py`

## Connections

- Patient, doctor, admin → Application routes: uses (evidence: `frontend/src/App.jsx`)
- Application routes → Authentication context: provides auth (evidence: `frontend/src/App.jsx`)
- Application routes → Role dashboards: routes to (evidence: `frontend/src/App.jsx`)
- Application routes → Doctor search: routes to (evidence: `frontend/src/App.jsx`)
- Application routes → Doctor profile: routes to (evidence: `frontend/src/App.jsx`)
- Application routes → Practice profile: routes to (evidence: `frontend/src/App.jsx`)
- Application routes → Appointment management: routes to (evidence: `frontend/src/App.jsx`)
- Application routes → Consultation pages: routes to (evidence: `frontend/src/App.jsx`)
- Authentication context → HTTP API client: requests identity (evidence: `frontend/src/context/AuthContext.jsx`)
- Role dashboards → HTTP API client: loads dashboard data (evidence: `frontend/src/pages/Dashboard.jsx`)
- Doctor search → HTTP API client: searches doctors (evidence: `frontend/src/pages/DoctorsList.jsx`)
- Doctor profile → HTTP API client: loads profile (evidence: `frontend/src/pages/DoctorProfile.jsx`)
- Practice profile → HTTP API client: updates profile (evidence: `frontend/src/pages/DoctorMyProfile.jsx`)
- Appointment management → HTTP API client: manages bookings (evidence: `frontend/src/pages/Appointments.jsx`)
- Consultation pages → HTTP API client: loads records (evidence: `frontend/src/pages/Consultations.jsx`)
- Appointment management → Consultation form: opens form (evidence: `frontend/src/pages/Appointments.jsx`)
- Consultation pages → Consultation form: opens form (evidence: `frontend/src/pages/Consultations.jsx`)
- Consultation form → HTTP API client: saves consultation (evidence: `frontend/src/components/ConsultationForm.jsx`)
- HTTP API client → Django REST API: calls API (evidence: `README.md`)
- Django REST API → User API views: routes identity
- Django REST API → Doctor API views: routes doctors
- Django REST API → Appointment API views: routes appointments
- Django REST API → Consultation API views: routes consultations
- User API views → User serializers: serializes users (evidence: `backend/users/views.py`)
- User API views → User and patient: reads user data (evidence: `backend/users/views.py`)
- User API views → Role permissions: checks roles (evidence: `backend/users/views.py`)
- User serializers → User and patient: creates profiles (evidence: `backend/users/serializers.py`)
- Doctor API views → Doctor serializers: serializes doctors (evidence: `backend/doctors/views.py`)
- Doctor API views → Doctor availability: reads availability (evidence: `backend/doctors/views.py`)
- Doctor API views → Role permissions: checks roles (evidence: `backend/doctors/views.py`)
- Doctor serializers → Doctor availability: serializes availability (evidence: `backend/doctors/serializers.py`)
- Appointment API views → Booking validation: validates requests (evidence: `backend/appointments/views.py`)
- Appointment API views → Appointment records: manages records (evidence: `backend/appointments/views.py`)
- Booking validation → Appointment records: checks conflicts (evidence: `backend/appointments/serializers.py`)
- Booking validation → Doctor serializers: embeds doctor data (evidence: `backend/appointments/serializers.py`)
- Booking validation → User serializers: embeds patient data (evidence: `backend/appointments/serializers.py`)
- Consultation API views → Consultation serializers: serializes records (evidence: `backend/consultations/views.py`)
- Consultation API views → Consultation records: manages records (evidence: `backend/consultations/views.py`)
- Consultation API views → Role permissions: checks access (evidence: `backend/consultations/views.py`)
- Consultation serializers → Consultation records: serializes records (evidence: `backend/consultations/serializers.py`)
