# juanospinanz-byte/medi-hora architecture

> Architecture diagram of the GitHub repository juanospinanz-byte/medi-hora, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/juanospinanz-byte/medi-hora
- Repository: https://github.com/juanospinanz-byte/medi-hora

## Overview

Medi-Hora is a mobile app for managing family profiles and medication dose schedules. Users register or sign in, view profiles and their medications, create or edit a profile, then schedule doses with frequency, times, and notes. The app sends requests through a shared authenticated API client to an Express backend, which verifies tokens and reads or writes MySQL data. The README contains no further feature detail, and profile routes, schema, and some screen behavior were not sampled; their connections are shown only where supported by the visible client calls and route registration.

Main entry points: [`frontend/src/api/client.js`](https://github.com/juanospinanz-byte/medi-hora/blob/main/frontend/src/api/client.js) (API client), [`frontend/src/screens/MainScreen.js`](https://github.com/juanospinanz-byte/medi-hora/blob/main/frontend/src/screens/MainScreen.js) (Family dashboard), [`frontend/App.js`](https://github.com/juanospinanz-byte/medi-hora/blob/main/frontend/App.js) (App navigation), [`backend/index.js`](https://github.com/juanospinanz-byte/medi-hora/blob/main/backend/index.js) (HTTP server)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_mobile["Mobile app"]
  node_app["App navigation<br/>[App.js]"]
  node_auth_screen["Sign in / register<br/>[AuthScreen.js]"]
  node_dashboard["Family dashboard<br/>[MainScreen.js]"]
  node_profile_form["Profile editor"]
  node_schedule["Dose scheduler"]
  node_api_client["API client<br/>[client.js]"]
end

subgraph group_api["Backend API"]
  node_server["HTTP server<br/>[index.js]"]
  node_auth_routes["Authentication routes<br/>[auth.js]"]
  node_profile_routes["Profile routes<br/>[profiles.js]"]
  node_med_routes["Medication routes<br/>[medications.js]"]
  node_auth_mw["Token authentication<br/>[auth.js]"]
end

subgraph group_data["Persistence"]
  node_db_module["Database connection<br/>[db.js]"]
  node_mysql[("MySQL database<br/>[schema.sql]")]
end

node_user(("App user"))

node_user -->|"uses"| node_app
node_app -->|"shows signed out"| node_auth_screen
node_app -->|"shows signed in"| node_dashboard
node_auth_screen -->|"requests auth"| node_api_client
node_auth_screen -->|"sets token"| node_app
node_app -->|"sets token"| node_api_client
node_dashboard -->|"loads profiles and meds"| node_api_client
node_dashboard -->|"opens editor"| node_profile_form
node_dashboard -->|"opens scheduler"| node_schedule
node_dashboard -->|"deletes profile or medication"| node_api_client
node_profile_form -->|"profile requests"| node_api_client
node_schedule -->|"loads profiles"| node_api_client
node_schedule -->|"saves medication"| node_api_client
node_api_client -->|"HTTP requests"| node_server
node_server -->|"dispatches auth"| node_auth_routes
node_server -->|"dispatches profiles"| node_profile_routes
node_server -->|"dispatches medications"| node_med_routes
node_auth_routes -->|"queries users"| node_db_module
node_med_routes -->|"requires token"| node_auth_mw
node_auth_mw -->|"sets user context"| node_med_routes
node_med_routes -->|"queries medications"| node_db_module
node_profile_routes -->|"database access"| node_db_module
node_db_module -->|"reads and writes"| node_mysql

click node_app "https://github.com/juanospinanz-byte/medi-hora/blob/main/frontend/App.js"
click node_auth_screen "https://github.com/juanospinanz-byte/medi-hora/blob/main/frontend/src/screens/AuthScreen.js"
click node_dashboard "https://github.com/juanospinanz-byte/medi-hora/blob/main/frontend/src/screens/MainScreen.js"
click node_profile_form "https://github.com/juanospinanz-byte/medi-hora/blob/main/frontend/src/screens/ProfileFormScreen.js"
click node_schedule "https://github.com/juanospinanz-byte/medi-hora/blob/main/frontend/src/screens/ScheduleReminderScreen.js"
click node_api_client "https://github.com/juanospinanz-byte/medi-hora/blob/main/frontend/src/api/client.js"
click node_server "https://github.com/juanospinanz-byte/medi-hora/blob/main/backend/index.js"
click node_auth_routes "https://github.com/juanospinanz-byte/medi-hora/blob/main/backend/routes/auth.js"
click node_profile_routes "https://github.com/juanospinanz-byte/medi-hora/blob/main/backend/routes/profiles.js"
click node_med_routes "https://github.com/juanospinanz-byte/medi-hora/blob/main/backend/routes/medications.js"
click node_auth_mw "https://github.com/juanospinanz-byte/medi-hora/blob/main/backend/middleware/auth.js"
click node_db_module "https://github.com/juanospinanz-byte/medi-hora/blob/main/backend/db.js"
click node_mysql "https://github.com/juanospinanz-byte/medi-hora/blob/main/backend/schema.sql"

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_auth_screen,node_dashboard,node_profile_form,node_schedule,node_api_client,node_user toneBlue
class node_server,node_auth_routes,node_profile_routes,node_med_routes,node_auth_mw toneAmber
class node_db_module,node_mysql toneMint
```

## Components

### Mobile app

- [App navigation](https://github.com/juanospinanz-byte/medi-hora/blob/main/frontend/App.js): `frontend/App.js`
- [Sign in / register](https://github.com/juanospinanz-byte/medi-hora/blob/main/frontend/src/screens/AuthScreen.js): `frontend/src/screens/AuthScreen.js`
- [Family dashboard](https://github.com/juanospinanz-byte/medi-hora/blob/main/frontend/src/screens/MainScreen.js): `frontend/src/screens/MainScreen.js`
- [Profile editor](https://github.com/juanospinanz-byte/medi-hora/blob/main/frontend/src/screens/ProfileFormScreen.js): `frontend/src/screens/ProfileFormScreen.js`
- [Dose scheduler](https://github.com/juanospinanz-byte/medi-hora/blob/main/frontend/src/screens/ScheduleReminderScreen.js): `frontend/src/screens/ScheduleReminderScreen.js`
- [API client](https://github.com/juanospinanz-byte/medi-hora/blob/main/frontend/src/api/client.js): `frontend/src/api/client.js`

### Backend API

- [HTTP server](https://github.com/juanospinanz-byte/medi-hora/blob/main/backend/index.js): `backend/index.js`
- [Authentication routes](https://github.com/juanospinanz-byte/medi-hora/blob/main/backend/routes/auth.js): `backend/routes/auth.js`
- [Profile routes](https://github.com/juanospinanz-byte/medi-hora/blob/main/backend/routes/profiles.js): `backend/routes/profiles.js`
- [Medication routes](https://github.com/juanospinanz-byte/medi-hora/blob/main/backend/routes/medications.js): `backend/routes/medications.js`
- [Token authentication](https://github.com/juanospinanz-byte/medi-hora/blob/main/backend/middleware/auth.js): `backend/middleware/auth.js`

### Persistence

- [Database connection](https://github.com/juanospinanz-byte/medi-hora/blob/main/backend/db.js): `backend/db.js`
- [MySQL database](https://github.com/juanospinanz-byte/medi-hora/blob/main/backend/schema.sql): `backend/schema.sql`

### Other components

- **App user**

## Connections

- App user → App navigation: uses
- App navigation → Sign in / register: shows signed out
- App navigation → Family dashboard: shows signed in
- Sign in / register → API client: requests auth
- Sign in / register → App navigation: sets token
- App navigation → API client: sets token
- Family dashboard → API client: loads profiles and meds
- Family dashboard → Profile editor: opens editor
- Family dashboard → Dose scheduler: opens scheduler
- Family dashboard → API client: deletes profile or medication
- Profile editor → API client: profile requests
- Dose scheduler → API client: loads profiles
- Dose scheduler → API client: saves medication
- API client → HTTP server: HTTP requests
- HTTP server → Authentication routes: dispatches auth
- HTTP server → Profile routes: dispatches profiles
- HTTP server → Medication routes: dispatches medications
- Authentication routes → Database connection: queries users
- Medication routes → Token authentication: requires token
- Token authentication → Medication routes: sets user context
- Medication routes → Database connection: queries medications
- Profile routes → Database connection: database access
- Database connection → MySQL database: reads and writes
