# harshitha-msd7/rock-bottom-girls- architecture

> Architecture diagram of the GitHub repository harshitha-msd7/rock-bottom-girls-, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/harshitha-msd7/rock-bottom-girls-
- Repository: https://github.com/harshitha-msd7/rock-bottom-girls-

## Overview

CareQ combines a caregiver mobile app, a watch-monitoring API, and watch-side services. The main workflow is caregiver configuration and status viewing alongside watch updates: the API validates updates, evaluates location and alert state, persists changes, and queues notifications. A separate Arduino-oriented service exposes watch state and hardware controls. The excerpts establish the API’s internal orchestration and persistence; frontend-to-API wiring and the relationship between the two watch services are not confirmed, so those links are omitted.

Main entry points: [`backend/src/server.js`](https://github.com/harshitha-msd7/rock-bottom-girls-/blob/main/backend/src/server.js) (API server), [`backend/src/app.js`](https://github.com/harshitha-msd7/rock-bottom-girls-/blob/main/backend/src/app.js) (Caregiver and watch API), [`backend/src/store.js`](https://github.com/harshitha-msd7/rock-bottom-girls-/blob/main/backend/src/store.js) (Transactional store), [`careQ/app.py`](https://github.com/harshitha-msd7/rock-bottom-girls-/blob/main/careQ/app.py) (Watch state and controls)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_mobile["Caregiver app"]
  node_mobile_app["Caregiver app<br/>[index.tsx]"]
  node_mobile_auth["Sign-in screens<br/>[login-screen.tsx]"]
  node_mobile_status["Patient status<br/>[patient-status.tsx]"]
  node_mobile_register["Registration"]
  node_mobile_settings["Care settings<br/>[settings.tsx]"]
  node_mobile_pair["Watch pairing<br/>[pair.tsx]"]
  node_mobile_record["Audio recording<br/>[record.tsx]"]
  node_api_client["API client<br/>[api.ts]"]
  node_push_client["Push registration<br/>[notifications.ts]"]
end

subgraph group_api["Monitoring API"]
  node_api_server["API server<br/>[server.js]"]
  node_api_routes["Caregiver and watch API<br/>[app.js]"]
  node_monitoring["Monitoring rules<br/>[monitoring.js]"]
  node_geocoder["Address geocoding<br/>[geocode.js]"]
  node_auth["Caregiver authentication<br/>[auth.js]"]
  node_device_routes["Device routes<br/>[device.routes.js]"]
  node_watch_routes["Watch routes<br/>[watch.routes.js]"]
end

subgraph group_watch["Watch services"]
  node_arduino_service["Watch state and controls<br/>[app.py]"]
  node_arduino_runtime["Arduino runtime<br/>[main.py]"]
  node_watch_client["Watch client<br/>[client.py]"]
end

subgraph group_infra["Data and alerts"]
  node_store["Transactional store<br/>[store.js]"]
  node_database_config["Database connection<br/>[database.js]"]
  node_postgres[("PostgreSQL")]
  node_push_worker["Push worker<br/>[notifications.js]"]
  node_push_service["Expo push service"]
end

node_caregiver(("Caregiver"))
node_watch_actor(("Watch"))

node_caregiver -.->|"uses"| node_mobile_app
node_api_server -->|"starts"| node_api_routes
node_api_server -->|"configures"| node_database_config
node_api_server -->|"creates"| node_store
node_api_server -->|"schedules checks"| node_monitoring
node_api_server -->|"schedules delivery"| node_push_worker
node_api_routes -->|"evaluates updates"| node_monitoring
node_api_routes -->|"reads and transacts"| node_store
node_api_routes -->|"looks up addresses"| node_geocoder
node_api_routes -.->|"verifies caregivers"| node_api_server
node_store -->|"reads and writes"| node_postgres
node_database_config -->|"configures connection"| node_postgres
node_store -->|"queues alert jobs"| node_push_worker
node_api_server -->|"loads patient checks"| node_store
node_push_client -->|"registers tokens through"| node_api_client
node_watch_actor -.->|"controls watch"| node_arduino_service
node_arduino_runtime -->|"starts server"| node_arduino_service
node_arduino_service -.->|"commands hardware"| node_watch_actor

click node_mobile_app "https://github.com/harshitha-msd7/rock-bottom-girls-/blob/main/frontend/src/app/(tabs)/index.tsx"
click node_mobile_auth "https://github.com/harshitha-msd7/rock-bottom-girls-/blob/main/frontend/src/components/login-screen.tsx"
click node_mobile_status "https://github.com/harshitha-msd7/rock-bottom-girls-/blob/main/frontend/src/components/patient-status.tsx"
click node_mobile_register "https://github.com/harshitha-msd7/rock-bottom-girls-/blob/main/frontend/src/components/register-screen.tsx"
click node_mobile_settings "https://github.com/harshitha-msd7/rock-bottom-girls-/blob/main/frontend/src/app/(tabs)/settings.tsx"
click node_mobile_pair "https://github.com/harshitha-msd7/rock-bottom-girls-/blob/main/frontend/src/app/(tabs)/pair.tsx"
click node_mobile_record "https://github.com/harshitha-msd7/rock-bottom-girls-/blob/main/frontend/src/app/(tabs)/record.tsx"
click node_api_client "https://github.com/harshitha-msd7/rock-bottom-girls-/blob/main/frontend/src/services/api.ts"
click node_push_client "https://github.com/harshitha-msd7/rock-bottom-girls-/blob/main/frontend/src/services/notifications.ts"
click node_api_server "https://github.com/harshitha-msd7/rock-bottom-girls-/blob/main/backend/src/server.js"
click node_api_routes "https://github.com/harshitha-msd7/rock-bottom-girls-/blob/main/backend/src/app.js"
click node_monitoring "https://github.com/harshitha-msd7/rock-bottom-girls-/blob/main/backend/src/monitoring.js"
click node_geocoder "https://github.com/harshitha-msd7/rock-bottom-girls-/blob/main/backend/src/geocode.js"
click node_auth "https://github.com/harshitha-msd7/rock-bottom-girls-/blob/main/backend/src/middleware/auth.js"
click node_device_routes "https://github.com/harshitha-msd7/rock-bottom-girls-/blob/main/backend/src/routes/device.routes.js"
click node_watch_routes "https://github.com/harshitha-msd7/rock-bottom-girls-/blob/main/backend/src/routes/watch.routes.js"
click node_arduino_service "https://github.com/harshitha-msd7/rock-bottom-girls-/blob/main/careQ/app.py"
click node_arduino_runtime "https://github.com/harshitha-msd7/rock-bottom-girls-/blob/main/careQ/python/main.py"
click node_watch_client "https://github.com/harshitha-msd7/rock-bottom-girls-/blob/main/watch/client.py"
click node_store "https://github.com/harshitha-msd7/rock-bottom-girls-/blob/main/backend/src/store.js"
click node_database_config "https://github.com/harshitha-msd7/rock-bottom-girls-/blob/main/backend/src/database.js"
click node_push_worker "https://github.com/harshitha-msd7/rock-bottom-girls-/blob/main/backend/src/notifications.js"

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_mobile_app,node_mobile_auth,node_mobile_status,node_mobile_register,node_mobile_settings,node_mobile_pair,node_mobile_record,node_api_client,node_push_client toneBlue
class node_api_server,node_api_routes,node_monitoring,node_geocoder,node_auth,node_device_routes,node_watch_routes toneAmber
class node_arduino_service,node_arduino_runtime,node_watch_client toneMint
class node_store,node_database_config,node_postgres,node_push_worker,node_push_service toneRose
class node_caregiver,node_watch_actor toneIndigo
```

## Components

### Caregiver app

- [Caregiver app](https://github.com/harshitha-msd7/rock-bottom-girls-/blob/main/frontend/src/app/(tabs)/index.tsx): `frontend/src/app/(tabs)/index.tsx`
- [Sign-in screens](https://github.com/harshitha-msd7/rock-bottom-girls-/blob/main/frontend/src/components/login-screen.tsx): `frontend/src/components/login-screen.tsx`
- [Patient status](https://github.com/harshitha-msd7/rock-bottom-girls-/blob/main/frontend/src/components/patient-status.tsx): `frontend/src/components/patient-status.tsx`
- [Registration](https://github.com/harshitha-msd7/rock-bottom-girls-/blob/main/frontend/src/components/register-screen.tsx): `frontend/src/components/register-screen.tsx`
- [Care settings](https://github.com/harshitha-msd7/rock-bottom-girls-/blob/main/frontend/src/app/(tabs)/settings.tsx): `frontend/src/app/(tabs)/settings.tsx`
- [Watch pairing](https://github.com/harshitha-msd7/rock-bottom-girls-/blob/main/frontend/src/app/(tabs)/pair.tsx): `frontend/src/app/(tabs)/pair.tsx`
- [Audio recording](https://github.com/harshitha-msd7/rock-bottom-girls-/blob/main/frontend/src/app/(tabs)/record.tsx): `frontend/src/app/(tabs)/record.tsx`
- [API client](https://github.com/harshitha-msd7/rock-bottom-girls-/blob/main/frontend/src/services/api.ts): `frontend/src/services/api.ts`
- [Push registration](https://github.com/harshitha-msd7/rock-bottom-girls-/blob/main/frontend/src/services/notifications.ts): `frontend/src/services/notifications.ts`

### Monitoring API

- [API server](https://github.com/harshitha-msd7/rock-bottom-girls-/blob/main/backend/src/server.js): `backend/src/server.js`
- [Caregiver and watch API](https://github.com/harshitha-msd7/rock-bottom-girls-/blob/main/backend/src/app.js): `backend/src/app.js`
- [Monitoring rules](https://github.com/harshitha-msd7/rock-bottom-girls-/blob/main/backend/src/monitoring.js): `backend/src/monitoring.js`
- [Address geocoding](https://github.com/harshitha-msd7/rock-bottom-girls-/blob/main/backend/src/geocode.js): `backend/src/geocode.js`
- [Caregiver authentication](https://github.com/harshitha-msd7/rock-bottom-girls-/blob/main/backend/src/middleware/auth.js): `backend/src/middleware/auth.js`
- [Device routes](https://github.com/harshitha-msd7/rock-bottom-girls-/blob/main/backend/src/routes/device.routes.js): `backend/src/routes/device.routes.js`
- [Watch routes](https://github.com/harshitha-msd7/rock-bottom-girls-/blob/main/backend/src/routes/watch.routes.js): `backend/src/routes/watch.routes.js`

### Watch services

- [Watch state and controls](https://github.com/harshitha-msd7/rock-bottom-girls-/blob/main/careQ/app.py): `careQ/app.py`
- [Arduino runtime](https://github.com/harshitha-msd7/rock-bottom-girls-/blob/main/careQ/python/main.py): `careQ/python/main.py`
- [Watch client](https://github.com/harshitha-msd7/rock-bottom-girls-/blob/main/watch/client.py): `watch/client.py`

### Data and alerts

- [Transactional store](https://github.com/harshitha-msd7/rock-bottom-girls-/blob/main/backend/src/store.js): `backend/src/store.js`
- [Database connection](https://github.com/harshitha-msd7/rock-bottom-girls-/blob/main/backend/src/database.js): `backend/src/database.js`
- **PostgreSQL**
- [Push worker](https://github.com/harshitha-msd7/rock-bottom-girls-/blob/main/backend/src/notifications.js): `backend/src/notifications.js`
- **Expo push service**

### Other components

- **Caregiver**
- **Watch**

## Connections

- Caregiver → Caregiver app: uses
- API server → Caregiver and watch API: starts (evidence: `backend/src/server.js`)
- API server → Database connection: configures (evidence: `backend/src/server.js`)
- API server → Transactional store: creates (evidence: `backend/src/server.js`)
- API server → Monitoring rules: schedules checks (evidence: `backend/src/server.js`)
- API server → Push worker: schedules delivery (evidence: `backend/src/server.js`)
- Caregiver and watch API → Monitoring rules: evaluates updates (evidence: `backend/src/app.js`)
- Caregiver and watch API → Transactional store: reads and transacts (evidence: `backend/src/app.js`)
- Caregiver and watch API → Address geocoding: looks up addresses (evidence: `backend/src/app.js`)
- Caregiver and watch API → API server: verifies caregivers (evidence: `backend/src/server.js`)
- Transactional store → PostgreSQL: reads and writes (evidence: `backend/src/store.js`)
- Database connection → PostgreSQL: configures connection (evidence: `backend/src/database.js`)
- Transactional store → Push worker: queues alert jobs (evidence: `backend/src/store.js`)
- API server → Transactional store: loads patient checks (evidence: `backend/src/server.js`)
- Push registration → API client: registers tokens through (evidence: `frontend/src/services/notifications.ts`)
- Watch → Watch state and controls: controls watch
- Arduino runtime → Watch state and controls: starts server (evidence: `careQ/python/main.py`)
- Watch state and controls → Watch: commands hardware
