# ntthong0710/medisafe_mobile_app architecture

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

- Interactive diagram: https://gitdiagram.com/ntthong0710/medisafe_mobile_app
- Repository: https://github.com/ntthong0710/medisafe_mobile_app

## Overview

##### Project Type and Purpose
- This project is a full-stack mobile application with a dedicated backend service. The frontend is built using a JavaScript/TypeScript framework (likely React Native, given files like App.js, .tsx components, and navigation-related code) and provides a user interface for interacting with health-related features. The backend (in the medisafe-backend directory) appears to be a Node.js/Express server that handles business logic for health conditions and symptoms, seeds initial data, and potentially exposes RESTful endpoints.

##### Analyzing the File Structure
- At the root, you have configuration files (e.g., .gitignore, babel.config.js, app.json, tsconfig.json, eas.json, vercel.json) that suggest mobile configuration and deployment settings.
- The "src" directory contains all the mobile client source code:
- "AuthContext.tsx" for state or authentication management.
- "components" directory with UI elements (cards for condition, medication, symptom, notifications, a sidebar).
- "screens" directory with individual views like Home, Login, Register, Profile, and specialized screens (HealthConditionLookup, Medication, SymptomSearch).
- "navigation" directory for routing between screens.
- "services" for handling API calls.
- "store" likely managing state (e.g., with a Redux slice for medication data).
- "utils" for constants and other helper functions.
- The “medisafe-backend” directory includes backend files:
- "server.js" as the entry point.
- Modules such as HealthCondition.js and Symptoms.js that encapsulate business logic.
- "seed.js" for initializing or seeding the data.
- Its own package.json and configuration file (vercel.json) for deployment.
- This structure indicates a clear separation between the mobile front-end and the backend API.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Mobile Client"
        MobileApp["Mobile App (React Native)"]
        UIComponents["UI Components"]
        Screens["Screens (Views)"]
        Navigation["Navigation System"]
        StateManagement["State Management & Auth"]
        APIIntegration["API Integration"]
    end

    subgraph "Backend Service"
        BackendServer["Backend Server (Node/Express)"]
        BusinessLogic["Business Logic Modules"]
        DataSeeding["Data Seeding Module"]
    end

    subgraph "Deployment (Vercel)"
        FrontendDeploy["Frontend Vercel Config"]
        BackendDeploy["Backend Vercel Config"]
    end

    %% Mobile internal flow
    MobileApp -->|"contains"| UIComponents
    UIComponents -->|"includes"| Screens
    Screens -->|"navigated by"| Navigation
    Navigation -->|"updates"| StateManagement
    StateManagement -->|"triggers"| APIIntegration

    %% Communication between Mobile and Backend
    APIIntegration -->|"REST_API_call"| BackendServer

    %% Backend internal flow
    BackendServer -->|"executes"| BusinessLogic
    BackendServer -->|"initializes"| DataSeeding

    %% Deployment associations
    MobileApp ---|"deployed_on"| FrontendDeploy
    BackendServer ---|"deployed_on"| BackendDeploy

    %% Click Events for Mobile Client
    click MobileApp "https://github.com/ntthong0710/medisafe_mobile_app/blob/main/App.js"
    click MobileApp "https://github.com/ntthong0710/medisafe_mobile_app/tree/main/src/"
    click UIComponents "https://github.com/ntthong0710/medisafe_mobile_app/tree/main/src/components/"
    click Screens "https://github.com/ntthong0710/medisafe_mobile_app/tree/main/src/screens/"
    click Navigation "https://github.com/ntthong0710/medisafe_mobile_app/blob/main/src/navigation/AppNavigator.tsx"
    click StateManagement "https://github.com/ntthong0710/medisafe_mobile_app/blob/main/src/AuthContext.tsx"
    click StateManagement "https://github.com/ntthong0710/medisafe_mobile_app/blob/main/src/store/medicationSlice.ts"
    click APIIntegration "https://github.com/ntthong0710/medisafe_mobile_app/blob/main/src/services/api.ts"

    %% Click Events for Backend Service
    click BackendServer "https://github.com/ntthong0710/medisafe_mobile_app/blob/main/medisafe-backend/server.js"
    click BusinessLogic "https://github.com/ntthong0710/medisafe_mobile_app/blob/main/medisafe-backend/HealthCondition.js"
    click BusinessLogic "https://github.com/ntthong0710/medisafe_mobile_app/blob/main/medisafe-backend/Symptoms.js"
    click DataSeeding "https://github.com/ntthong0710/medisafe_mobile_app/blob/main/medisafe-backend/seed.js"

    %% Click Events for Deployment Configurations
    click FrontendDeploy "https://github.com/ntthong0710/medisafe_mobile_app/blob/main/src/vercel.json"
    click BackendDeploy "https://github.com/ntthong0710/medisafe_mobile_app/blob/main/medisafe-backend/vercel.json"

    %% Styles
    class MobileApp,UIComponents,Screens,Navigation,StateManagement,APIIntegration mobile
    class BackendServer,BusinessLogic,DataSeeding backend
    class FrontendDeploy,BackendDeploy deploy
```
