# aboosa-1/rare-care architecture

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

- Interactive diagram: https://gitdiagram.com/aboosa-1/rare-care
- Repository: https://github.com/aboosa-1/rare-care

## Overview

##### Project type and purpose
- This is a cross-platform mobile/desktop/web application built with Flutter (“rarecare”), focused on healthcare features: user authentication, chat-bot, image-based disease detection (face and X-ray), settings, onboarding, and Firebase integration.

##### File structure
- Top-level directories:
- android, ios, linux, macos, windows, web – platform embeds generated by Flutter
- lib – Flutter/Dart app source code (UI pages, theme, Firebase options, image picker plugin wrapper)
- assets – images and localization JSONs
- test – widget tests
- firebase.json – Firebase Hosting or Functions configuration
- In lib: pages for onboarding, auth, home, chatbot, image-disease, X-ray, settings, about_us, plus firebase_options.dart, theme.dart, and an embedded image_picker plugin.
- Presence of pubspec.yaml, firebase.json indicates use of Firebase services (Auth, Firestore/Storage, maybe Functions).

##### README
- It’s a standard Flutter starter readme; no bespoke architecture docs. We infer architecture from file tree and Firebase config.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Flutter Client Layer
    subgraph "Flutter Client" 
        direction TB
        subgraph "Presentation Layer"
            direction TB
            Main["lib/main.dart"]:::client
            Onboarding["lib/onboarding_screen.dart"]:::client
            AuthPage["lib/auth_page.dart"]:::client
            Home["lib/home_screen.dart"]:::client
            Chatbot["lib/chatbot_page.dart"]:::client
            FacePage["lib/face_disease_page.dart"]:::client
            XrayPage["lib/xray_page.dart"]:::client
            Settings["lib/settings_page.dart"]:::client
            AboutUs["lib/about_us_page.dart"]:::client
            Splash["lib/splash_screen.dart"]:::client
        end
        subgraph "Theme & Routing"
            Theme["lib/theme.dart"]:::client
        end
        subgraph "Firebase Init & Config"
            FirebaseOptions["lib/firebase_options.dart"]:::client
            FirebaseConfig["firebase.json"]:::client
            GoogleServices["android/app/google-services.json"]:::client
        end
    end

    %% Plugin & On-Device Services
    subgraph "Plugin & On-Device Services"
        direction TB
        ImagePicker["lib/image_picker/image_picker.dart"]:::plugin
        MainActivity["android/app/src/main/kotlin/com/example/rarecare/MainActivity.kt"]:::native
        IOSRegistrant["ios/GeneratedPluginRegistrant"]:::native
        LinuxRegistrant["linux/flutter/generated_plugin_registrant.cc"]:::native
        MacOSRegistrant["macos/Flutter/GeneratedPluginRegistrant.swift"]:::native
        WindowsRegistrant["windows/flutter/generated_plugin_registrant.cc"]:::native
    end

    %% Platform Runners
    subgraph "Platform Runners (Native Embeds)"
        direction TB
        AndroidDir["android/"]:::native
        IOSDir["ios/"]:::native
        LinuxDir["linux/"]:::native
        MacOSDir["macos/"]:::native
        WindowsDir["windows/"]:::native
        WebIndex["web/index.html"]:::native
        WebManifest["web/manifest.json"]:::native
    end

    %% Assets & Localization
    subgraph "Assets & Localization"
        direction TB
        Images["assets/images/"]:::asset
        ARLocale["assets/translations/ar.json"]:::asset
        ENLocale["assets/translations/en.json"]:::asset
    end

    %% Firebase Cloud Services
    subgraph "Firebase Cloud Services"
        direction TB
        Auth["Auth Service"]:::cloud
        Firestore["Firestore Database"]:::cloud
        Storage["Storage Bucket"]:::cloud
        Functions["Cloud Functions"]:::cloud
    end

    %% Tests
    subgraph "Tests"
        WidgetTest["test/widget_test.dart"]:::test
    end

    %% Relationships
    Main -->|uses| Onboarding
    Main -->|routes| AuthPage
    Main -->|routes| Home
    Main -->|routes| Chatbot
    Main -->|routes| FacePage
    Main -->|routes| XrayPage
    Main -->|routes| Settings
    Main -->|routes| AboutUs
    Main -->|routes| Splash

    Onboarding -->|reads| Theme
    AuthPage -->|initializes| FirebaseOptions
    AuthPage -->|reads| FirebaseConfig
    AuthPage -->|reads| GoogleServices
    Home -->|fetches/saves| Firestore
    Chatbot -->|calls| Functions
    FacePage -->|uploads| Storage
    FacePage -->|calls| Functions
    XrayPage -->|uploads| Storage
    XrayPage -->|calls| Functions
    FacePage -->|uses| ImagePicker
    XrayPage -->|uses| ImagePicker
    ImagePicker -->|platform channel| MainActivity
    ImagePicker -->|"plugin regist."| IOSRegistrant
    ImagePicker -->|"plugin regist."| LinuxRegistrant
    ImagePicker -->|"plugin regist."| MacOSRegistrant
    ImagePicker -->|"plugin regist."| WindowsRegistrant

    Main -->|includes| Images
    Main -->|loads| ARLocale
    Main -->|loads| ENLocale

    Main -->|tests| WidgetTest

    %% Flutter to Cloud
    AuthPage -->|auth requests| Auth
    Home -->|db requests| Firestore
    Chatbot -->|AI requests| Functions
    FacePage -->|store images| Storage
    XrayPage -->|store images| Storage

    %% Click Events
    click Main "https://github.com/aboosa-1/rare-care/blob/main/lib/main.dart"
    click Onboarding "https://github.com/aboosa-1/rare-care/blob/main/lib/onboarding_screen.dart"
    click AuthPage "https://github.com/aboosa-1/rare-care/blob/main/lib/auth_page.dart"
    click Home "https://github.com/aboosa-1/rare-care/blob/main/lib/home_screen.dart"
    click Chatbot "https://github.com/aboosa-1/rare-care/blob/main/lib/chatbot_page.dart"
    click FacePage "https://github.com/aboosa-1/rare-care/blob/main/lib/face_disease_page.dart"
    click XrayPage "https://github.com/aboosa-1/rare-care/blob/main/lib/xray_page.dart"
    click Settings "https://github.com/aboosa-1/rare-care/blob/main/lib/settings_page.dart"
    click AboutUs "https://github.com/aboosa-1/rare-care/blob/main/lib/about_us_page.dart"
    click Splash "https://github.com/aboosa-1/rare-care/blob/main/lib/splash_screen.dart"
    click Theme "https://github.com/aboosa-1/rare-care/blob/main/lib/theme.dart"
    click FirebaseOptions "https://github.com/aboosa-1/rare-care/blob/main/lib/firebase_options.dart"
    click FirebaseConfig "https://github.com/aboosa-1/rare-care/blob/main/firebase.json"
    click GoogleServices "https://github.com/aboosa-1/rare-care/blob/main/android/app/google-services.json"
    click ImagePicker "https://github.com/aboosa-1/rare-care/blob/main/lib/image_picker/image_picker.dart"
    click MainActivity "https://github.com/aboosa-1/rare-care/blob/main/android/app/src/main/kotlin/com/example/rarecare/MainActivity.kt"
    click IOSRegistrant "https://github.com/aboosa-1/rare-care/tree/main/ios/GeneratedPluginRegistrant"
    click LinuxRegistrant "https://github.com/aboosa-1/rare-care/blob/main/linux/flutter/generated_plugin_registrant.cc"
    click MacOSRegistrant "https://github.com/aboosa-1/rare-care/blob/main/macos/Flutter/GeneratedPluginRegistrant.swift"
    click WindowsRegistrant "https://github.com/aboosa-1/rare-care/blob/main/windows/flutter/generated_plugin_registrant.cc"
    click AndroidDir "https://github.com/aboosa-1/rare-care/tree/main/android/"
    click IOSDir "https://github.com/aboosa-1/rare-care/tree/main/ios/"
    click LinuxDir "https://github.com/aboosa-1/rare-care/tree/main/linux/"
    click MacOSDir "https://github.com/aboosa-1/rare-care/tree/main/macos/"
    click WindowsDir "https://github.com/aboosa-1/rare-care/tree/main/windows/"
    click WebIndex "https://github.com/aboosa-1/rare-care/blob/main/web/index.html"
    click WebManifest "https://github.com/aboosa-1/rare-care/blob/main/web/manifest.json"
    click Images "https://github.com/aboosa-1/rare-care/tree/main/assets/images/"
    click ARLocale "https://github.com/aboosa-1/rare-care/blob/main/assets/translations/ar.json"
    click ENLocale "https://github.com/aboosa-1/rare-care/blob/main/assets/translations/en.json"
    click WidgetTest "https://github.com/aboosa-1/rare-care/blob/main/test/widget_test.dart"

    %% Styles
    classDef client fill:#D6EAF8,stroke:#3498DB,color:#154360
    classDef plugin fill:#FDEDEC,stroke:#E74C3C,color:#641E16
    classDef native fill:#E5E7E9,stroke:#7B7D7D,color:#1C2833
    classDef cloud fill:#D5F5E3,stroke:#27AE60,color:#145A32
    classDef asset fill:#FCF3CF,stroke:#F1C40F,color:#7D6608
    classDef test fill:#EBDEF0,stroke:#8E44AD,color:#4A235A
```
