# ebrahimgad123/medremind-reactnative architecture

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

- Interactive diagram: https://gitdiagram.com/ebrahimgad123/medremind-reactnative
- Repository: https://github.com/ebrahimgad123/medremind-reactnative

## Overview

##### Project type and purpose
- This is a cross-platform mobile application built with Expo and React Native (TypeScript).
- It provides medication reminders, scheduling, and local notification functionality.
- There is no separate backend server in the repo; all data storage and scheduling logic lives on the device (AsyncStorage and Expo Notifications).

##### File structure
- Top level:
- android/ — native Android “shell” (Gradle scripts, MainActivity.kt, MainApplication.kt)
- app/ — Expo Router pages (file-based routing: addMedication.tsx, auth.tsx, home.tsx, etc.)
- components/ — reusable UI (CircularProgress, NotificationDrawer)
- utils/ — helper modules (Storage.ts for AsyncStorage; notification.ts for scheduling via Expo Notifications)
- assets/ — fonts and images
- constant/ — value definitions (constantHome.tsx)
- config files: app.json, eas.json, tsconfig.json, package.json, metro (implicit via Expo)

##### README
- Confirms it’s generated by create-expo-app.
- Uses file-based routing in the app/ directory via Expo Router.
- No explicit backend instructions → client-only.

##### Main components
a. Developer & Toolchain
- Expo CLI / Metro Bundler (local dev server)
- npm / eas (build & publish)
b. Mobile Host (Android & iOS runtimes)
- Native shell (MainActivity.kt & MainApplication.kt on Android; similar on iOS in Expo client)
- JavaScriptCore / Hermes runtime
c. JavaScript Application
- App entry (_layout.tsx) and Router → Screen modules under app/
- Reusable UI components (components/)
- Domain logic (utils/, constant/)
- Assets loader (fonts/images)
d. Persistence & Notifications
- AsyncStorage (via utils/Storage.ts)
- Expo Notifications API (via utils/notification.ts + native bridge)
e. External Services (optional)
- Expo push notification service (for remote pushes, if used)
- Over-the-air updates (Expo Updates)

##### Relationships & data flow
- Developer invokes Expo CLI → Metro Bundler serves JS bundle → Device runtime loads bundle
- User interacts with UI screens → components call domain logic in utils → state read/write to AsyncStorage
- Scheduling a reminder → utils/notification.ts calls Expo Notifications native API → OS schedules local push
- At runtime, Notifications → delivered to app → NotificationDrawer component renders

##### Architectural patterns & design principles
- File-based routing (one TSX file = one screen)
- Modular separation: UI (components) vs. business logic (utils/constant)
- Native-JS bridge (Expo’s managed workflow)
- Client-only data layer (no remote API)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Developer & Toolchain
    subgraph "Development Tools" 
        DevTools["Expo CLI & Metro Bundler"]:::devtools
        Pkg["package.json"]:::devtools
        EAS["eas.json"]:::devtools
        TSC["tsconfig.json"]:::devtools
        AppCfg["app.json"]:::devtools
    end

    %% Native Shell
    subgraph "Native Shell (Android/iOS)" 
        AndroidShell["Android Shell"]:::native
        MainAct["MainActivity.kt"]:::native
        MainApp["MainApplication.kt"]:::native
        iOSShell["iOS Shell"]:::native
    end

    %% JS Runtime & App Code
    subgraph "JavaScript Runtime & App Code"
        JSRuntime["JS Runtime (Hermes/JSC)"]:::jsapp

        subgraph "Router & Screens"
            Router["_layout.tsx (Router)"]:::jsapp
            Index["index.tsx"]:::jsapp
            Home["home.tsx"]:::jsapp
            AddMed["addMedication.tsx"]:::jsapp
            Auth["auth.tsx"]:::jsapp
            Calender["calender.tsx"]:::jsapp
            Refills["refills.tsx"]:::jsapp
            NotFound["+not-found.tsx"]:::jsapp
        end

        subgraph "UI Components"
            CircProg["CircularProgress.tsx"]:::jsapp
            NotiDrawer["NotificationDrawer.tsx"]:::jsapp
        end

        subgraph "Domain Logic & Helpers"
            Storage["Storage.ts"]:::storage
            NotificationUtil["notification.ts"]:::storage
            ConstHome["constantHome.tsx"]:::storage
        end

        subgraph "Assets"
            Fonts["fonts/"]:::storage
            Images["images/"]:::storage
        end
    end

    %% External Services
    subgraph "External Services"
        ExpoPush["Expo Push Notification Service"]:::external
        OTA["Expo OTA Updates"]:::external
    end

    %% Connections
    DevTools -->|"bundle JS"| AndroidShell
    AndroidShell -->|"load bundle"| JSRuntime
    JSRuntime -->|"initialize Router"| Router

    Router -->|navigate| Index
    Router -->|navigate| Home
    Router -->|navigate| AddMed
    Router -->|navigate| Auth
    Router -->|navigate| Calender
    Router -->|navigate| Refills
    Router -->|navigate| NotFound

    Index -->|renders| CircProg
    Home -->|renders| NotiDrawer

    CircProg -->|calls| Storage
    NotiDrawer -->|listens| NotificationUtil

    Home -->|read/write| Storage
    AddMed -->|schedule| NotificationUtil

    Storage -->|"AsyncStorage"| AndroidShell
    NotificationUtil -->|"Expo Notifications API"| AndroidShell

    NotificationUtil -->|"remote push"| ExpoPush
    DevTools -->|"publish OTA"| OTA
    OTA -->|"update bundle"| AndroidShell

    AndroidShell -->|"deliver local notification"| NotiDrawer

    %% Click Events
    click Pkg "https://github.com/ebrahimgad123/medremind-reactnative/blob/main/package.json"
    click EAS "https://github.com/ebrahimgad123/medremind-reactnative/blob/main/eas.json"
    click TSC "https://github.com/ebrahimgad123/medremind-reactnative/blob/main/tsconfig.json"
    click AppCfg "https://github.com/ebrahimgad123/medremind-reactnative/blob/main/app.json"
    click MainAct "https://github.com/ebrahimgad123/medremind-reactnative/blob/main/android/app/src/main/java/com/ibrahimgad/medremind/MainActivity.kt"
    click MainApp "https://github.com/ebrahimgad123/medremind-reactnative/blob/main/android/app/src/main/java/com/ibrahimgad/medremind/MainApplication.kt"
    click Router "https://github.com/ebrahimgad123/medremind-reactnative/blob/main/app/_layout.tsx"
    click Index "https://github.com/ebrahimgad123/medremind-reactnative/blob/main/app/index.tsx"
    click Home "https://github.com/ebrahimgad123/medremind-reactnative/blob/main/app/home.tsx"
    click AddMed "https://github.com/ebrahimgad123/medremind-reactnative/blob/main/app/addMedication.tsx"
    click Auth "https://github.com/ebrahimgad123/medremind-reactnative/blob/main/app/auth.tsx"
    click Calender "https://github.com/ebrahimgad123/medremind-reactnative/blob/main/app/calender.tsx"
    click Refills "https://github.com/ebrahimgad123/medremind-reactnative/blob/main/app/refills.tsx"
    click NotFound "https://github.com/ebrahimgad123/medremind-reactnative/blob/main/app/+not-found.tsx"
    click CircProg "https://github.com/ebrahimgad123/medremind-reactnative/blob/main/components/CircularProgress.tsx"
    click NotiDrawer "https://github.com/ebrahimgad123/medremind-reactnative/blob/main/components/NotificationDrawer.tsx"
    click Storage "https://github.com/ebrahimgad123/medremind-reactnative/blob/main/utils/Storage.ts"
    click NotificationUtil "https://github.com/ebrahimgad123/medremind-reactnative/blob/main/utils/notification.ts"
    click ConstHome "https://github.com/ebrahimgad123/medremind-reactnative/blob/main/constant/constantHome.tsx"
    click Fonts "https://github.com/ebrahimgad123/medremind-reactnative/tree/main/assets/fonts/"
    click Images "https://github.com/ebrahimgad123/medremind-reactnative/tree/main/assets/images/"

    %% Styles
    classDef devtools fill:#D0E8FF,stroke:#0080FF,color:#003366;
    classDef native fill:#FFE5CC,stroke:#FF8000,color:#663300;
    classDef jsapp fill:#E6FFE6,stroke:#33CC33,color:#006600;
    classDef storage fill:#F0F0F0,stroke:#999999,color:#333333;
    classDef external fill:#F0F0F0,stroke:#999999,color:#333333;
```
