# montahajaballah/elderlycare architecture

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

- Interactive diagram: https://gitdiagram.com/montahajaballah/elderlycare
- Repository: https://github.com/montahajaballah/elderlycare

## Overview

##### Project type and purpose
- This is a full-stack, microservices-based platform (“ElderlyCareHub”) for elderly care management.
- It provides an Angular frontend, Spring Boot microservices (User, DoctorManagement, MedicalEquipment, MedicationService, RendezVous), plus supporting infrastructure: API Gateway, Eureka Server (service discovery), Config Server, and Keycloak for authentication.

##### File structure
- Top‐level directories:
- front/ (Angular UI)
- api-gateway/ (Spring Cloud API Gateway)
- eureka-server/ (Spring Cloud Eureka discovery)
- Server_config/ (Spring Cloud Config Server)
- DoctorManagement_, MedicalEquipment, MedicationService, RendezVous, user/ (domain microservices)
- docker-compose.yml (orchestrates all services)
- Each microservice has the typical Spring Boot structure: controllers, services, repositories, entities, config.
- The frontend uses Angular modules, components, services, and Keycloak integration.
- Infrastructure services register with Eureka and fetch configuration from the Config Server.

##### README for additional insights
- Architecture Overview section confirms microservices, API Gateway, Eureka, Config Server, Keycloak, Docker Compose.
- Each microservice’s responsibilities are spelled out (e.g., equipment tracking, medication schedules, appointment scheduling).
- External integrations: OpenWeatherMap, MailerSend, AI chatbot, SMS.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Client and Auth
    Browser["Browser"]:::external
    Frontend["Angular Frontend"]:::frontend
    Keycloak["Keycloak"]:::external

    Browser -->|"HTTP/HTTPS"| Frontend
    Frontend -->|"API Calls"| APIGateway
    Frontend -->|"Auth Redirects"| Keycloak
    APIGateway -->|"Token Validation"| Keycloak

    %% Infrastructure Services
    subgraph "Infrastructure Services"
        direction TB
        APIGateway["API Gateway"]:::gateway
        Eureka["Eureka Server"]:::infra
        ConfigServer["Config Server"]:::infra
    end

    APIGateway -->|"Service Discovery"| Eureka

    %% Microservices and Databases
    subgraph "Microservices"
        direction TB
        subgraph "User Context"
            direction TB
            UserService["User Service"]:::service
            UserDB[(UserDB)]:::db
        end
        subgraph "Doctor Context"
            direction TB
            DoctorService["DoctorManagement Service"]:::service
            DoctorDB[(DoctorDB)]:::db
        end
        subgraph "Equipment Context"
            direction TB
            EquipmentService["MedicalEquipment Service"]:::service
            EquipmentDB[(EquipmentDB)]:::db
        end
        subgraph "Medication Context"
            direction TB
            MedicationService["Medication Service"]:::service
            MedicationDB[(MedicationDB)]:::db
        end
        subgraph "Appointment Context"
            direction TB
            RendezVousService["RendezVous Service"]:::service
            RendezVousDB[(RendezVousDB)]:::db
        end
    end

    %% Interactions with Infra
    classDef dashed stroke-dasharray: 5 5;
    UserService -.->|Register/Config| Eureka
    DoctorService -.->|Register/Config| Eureka
    EquipmentService -.->|Register/Config| Eureka
    MedicationService -.->|Register/Config| Eureka
    RendezVousService -.->|Register/Config| Eureka

    UserService -.->|Fetch Config| ConfigServer
    DoctorService -.->|Fetch Config| ConfigServer
    EquipmentService -.->|Fetch Config| ConfigServer
    MedicationService -.->|Fetch Config| ConfigServer
    RendezVousService -.->|Fetch Config| ConfigServer

    %% API Gateway to Microservices
    APIGateway -->|"user/**"| UserService
    APIGateway -->|"doctors/**"| DoctorService
    APIGateway -->|"equipment/**"| EquipmentService
    APIGateway -->|"medication/**"| MedicationService
    APIGateway -->|"appointments/**"| RendezVousService

    %% Databases
    UserService -->|Reads/Writes| UserDB
    DoctorService -->|Reads/Writes| DoctorDB
    EquipmentService -->|Reads/Writes| EquipmentDB
    MedicationService -->|Reads/Writes| MedicationDB
    RendezVousService -->|Reads/Writes| RendezVousDB

    %% External APIs
    OpenWeather["OpenWeatherMap API"]:::external
    MailerSend["MailerSend API"]:::external
    SMSProvider["SMS Provider"]:::external
    AIChat["AI Chat Service"]:::external

    EquipmentService -->|"Weather Data"| OpenWeather
    MedicationService -->|"Email Notifications"| MailerSend
    RendezVousService -->|"SMS Notifications"| SMSProvider
    DoctorService -->|"AI Assistance"| AIChat

    %% Docker Compose Boundary
    subgraph "Docker Compose Orchestration"
        direction TB
        Browser
        Frontend
        APIGateway
        Eureka
        ConfigServer
        UserService
        DoctorService
        EquipmentService
        MedicationService
        RendezVousService
    end

    %% Click Events
    click Frontend "https://github.com/montahajaballah/elderlycare/tree/main/front/"
    click APIGateway "https://github.com/montahajaballah/elderlycare/tree/main/api-gateway/"
    click Eureka "https://github.com/montahajaballah/elderlycare/tree/main/eureka-server/"
    click ConfigServer "https://github.com/montahajaballah/elderlycare/tree/main/Server_config/"
    click UserService "https://github.com/montahajaballah/elderlycare/tree/main/user/"
    click DoctorService "https://github.com/montahajaballah/elderlycare/tree/main/DoctorManagement_/"
    click EquipmentService "https://github.com/montahajaballah/elderlycare/tree/main/MedicalEquipment/"
    click MedicationService "https://github.com/montahajaballah/elderlycare/tree/main/MedicationService/"
    click RendezVousService "https://github.com/montahajaballah/elderlycare/tree/main/RendezVous/"
    click DockerCompose "https://github.com/montahajaballah/elderlycare/blob/main/docker-compose.yml"

    %% Styles
    classDef frontend fill:#AED6F1,stroke:#1F618D,color:#1B2631;
    classDef gateway fill:#D5D8DC,stroke:#566573,color:#1B2631;
    classDef infra fill:#F4F6F7,stroke:#ABB2B9,color:#1B2631;
    classDef service fill:#ABEBC6,stroke:#239B56,color:#1B2631;
    classDef db fill:#F9E79F,stroke:#B7950B,color:#1B2631;
    classDef external fill:#F5B7B1,stroke:#922B21,color:#1B2631;
    class APIGateway,Eureka,ConfigServer dashed;
```
