# gabbygab05/gemclinic architecture

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

- Interactive diagram: https://gitdiagram.com/gabbygab05/gemclinic
- Repository: https://github.com/gabbygab05/gemclinic

## Overview

GEM Clinic is a single-instance clinic workspace for appointment scheduling, patient contacts, restricted clinical notes, and account administration. The main workflow is staff signing in through the web or Expo Go app, then using permission-checked server endpoints to view or change clinic records. The Node.js server handles the API and uses encrypted SQLite persistence; the mobile app also keeps its session token in platform secure storage. The server is shown as a monolith because the available source excerpts do not establish separate internal modules; unsampled capabilities are retained where the README documents them.

Main entry points: [`server.js`](https://github.com/gabbygab05/gemclinic/blob/main/server.js) (HTTP API), [`mobile/App.js`](https://github.com/gabbygab05/gemclinic/blob/main/mobile/App.js) (Mobile workspace), [`public/app.js`](https://github.com/gabbygab05/gemclinic/blob/main/public/app.js) (Web workspace)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_clients["Clinic clients"]
  node_web["Web workspace<br/>[app.js]"]
  node_mobile["Mobile workspace<br/>[App.js]"]
  node_securestore[("Secure session store<br/>[App.js]")]
end

subgraph group_server["Clinic server"]
  node_api["HTTP API<br/>[server.js]"]
  node_identity["Sign-in and sessions<br/>[server.js]"]
  node_access["Permission checks<br/>[server.js]"]
  node_persistence[("Encrypted SQLite persistence<br/>[server.js]")]
end

subgraph group_records["Clinic records"]
  node_dashboard["Clinic dashboard<br/>[server.js]"]
  node_appointments["Appointment scheduling<br/>[server.js]"]
  node_contacts["Patient contacts<br/>[server.js]"]
  node_clinical["Clinical notes<br/>[server.js]"]
end

subgraph group_admin["Administration"]
  node_audit["Audit events<br/>[server.js]"]
  node_accounts["Account administration<br/>[server.js]"]
  node_security["Security settings<br/>[server.js]"]
  node_backups["Encrypted backups<br/>[server.js]"]
end

node_staff(("Clinic staff"))

node_staff -->|"uses"| node_web
node_staff -->|"uses"| node_mobile
node_web -->|"requests endpoints"| node_api
node_mobile -->|"connects to"| node_api
node_mobile -->|"stores session"| node_securestore
node_api -->|"handles sign-in"| node_identity
node_api -->|"checks permissions"| node_access
node_api -->|"serves dashboard"| node_dashboard
node_api -->|"serves scheduling"| node_appointments
node_api -->|"serves contacts"| node_contacts
node_api -->|"saves notes"| node_clinical
node_api -->|"manages accounts"| node_accounts
node_api -->|"reviews security"| node_security
node_api -->|"manages backups"| node_backups
node_api -->|"records actions"| node_audit
node_dashboard -->|"reads records"| node_persistence
node_appointments -->|"reads and writes"| node_persistence
node_contacts -->|"reads and writes"| node_persistence
node_clinical -->|"stores encrypted notes"| node_persistence
node_accounts -->|"stores accounts"| node_persistence
node_audit -->|"stores events"| node_persistence
node_backups -->|"backs up data"| node_persistence

click node_web "https://github.com/gabbygab05/gemclinic/blob/main/public/app.js"
click node_mobile "https://github.com/gabbygab05/gemclinic/blob/main/mobile/App.js"
click node_securestore "https://github.com/gabbygab05/gemclinic/blob/main/mobile/App.js"
click node_api "https://github.com/gabbygab05/gemclinic/blob/main/server.js"
click node_identity "https://github.com/gabbygab05/gemclinic/blob/main/server.js"
click node_access "https://github.com/gabbygab05/gemclinic/blob/main/server.js"
click node_dashboard "https://github.com/gabbygab05/gemclinic/blob/main/server.js"
click node_appointments "https://github.com/gabbygab05/gemclinic/blob/main/server.js"
click node_contacts "https://github.com/gabbygab05/gemclinic/blob/main/server.js"
click node_clinical "https://github.com/gabbygab05/gemclinic/blob/main/server.js"
click node_audit "https://github.com/gabbygab05/gemclinic/blob/main/server.js"
click node_accounts "https://github.com/gabbygab05/gemclinic/blob/main/server.js"
click node_security "https://github.com/gabbygab05/gemclinic/blob/main/server.js"
click node_backups "https://github.com/gabbygab05/gemclinic/blob/main/server.js"
click node_persistence "https://github.com/gabbygab05/gemclinic/blob/main/server.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_web,node_mobile,node_securestore toneBlue
class node_api,node_identity,node_access,node_persistence toneAmber
class node_dashboard,node_appointments,node_contacts,node_clinical toneMint
class node_audit,node_accounts,node_security,node_backups toneRose
class node_staff toneIndigo
```

## Components

### Clinic clients

- [Web workspace](https://github.com/gabbygab05/gemclinic/blob/main/public/app.js): `public/app.js`
- [Mobile workspace](https://github.com/gabbygab05/gemclinic/blob/main/mobile/App.js): `mobile/App.js`
- [Secure session store](https://github.com/gabbygab05/gemclinic/blob/main/mobile/App.js): `mobile/App.js`

### Clinic server

- [HTTP API](https://github.com/gabbygab05/gemclinic/blob/main/server.js): `server.js`
- [Sign-in and sessions](https://github.com/gabbygab05/gemclinic/blob/main/server.js): `server.js`
- [Permission checks](https://github.com/gabbygab05/gemclinic/blob/main/server.js): `server.js`
- [Encrypted SQLite persistence](https://github.com/gabbygab05/gemclinic/blob/main/server.js): `server.js`

### Clinic records

- [Clinic dashboard](https://github.com/gabbygab05/gemclinic/blob/main/server.js): `server.js`
- [Appointment scheduling](https://github.com/gabbygab05/gemclinic/blob/main/server.js): `server.js`
- [Patient contacts](https://github.com/gabbygab05/gemclinic/blob/main/server.js): `server.js`
- [Clinical notes](https://github.com/gabbygab05/gemclinic/blob/main/server.js): `server.js`

### Administration

- [Audit events](https://github.com/gabbygab05/gemclinic/blob/main/server.js): `server.js`
- [Account administration](https://github.com/gabbygab05/gemclinic/blob/main/server.js): `server.js`
- [Security settings](https://github.com/gabbygab05/gemclinic/blob/main/server.js): `server.js`
- [Encrypted backups](https://github.com/gabbygab05/gemclinic/blob/main/server.js): `server.js`

### Other components

- **Clinic staff**

## Connections

- Clinic staff → Web workspace: uses (evidence: `README.md`)
- Clinic staff → Mobile workspace: uses (evidence: `README.md`)
- Web workspace → HTTP API: requests endpoints (evidence: `public/app.js`)
- Mobile workspace → HTTP API: connects to (evidence: `README.md`)
- Mobile workspace → Secure session store: stores session (evidence: `README.md`)
- HTTP API → Sign-in and sessions: handles sign-in (evidence: `server.js`)
- HTTP API → Permission checks: checks permissions (evidence: `README.md`)
- HTTP API → Clinic dashboard: serves dashboard (evidence: `server.js`)
- HTTP API → Appointment scheduling: serves scheduling (evidence: `server.js`)
- HTTP API → Patient contacts: serves contacts (evidence: `server.js`)
- HTTP API → Clinical notes: saves notes (evidence: `server.js`)
- HTTP API → Account administration: manages accounts (evidence: `README.md`)
- HTTP API → Security settings: reviews security (evidence: `README.md`)
- HTTP API → Encrypted backups: manages backups (evidence: `README.md`)
- HTTP API → Audit events: records actions (evidence: `server.js`)
- Clinic dashboard → Encrypted SQLite persistence: reads records (evidence: `server.js`)
- Appointment scheduling → Encrypted SQLite persistence: reads and writes (evidence: `server.js`)
- Patient contacts → Encrypted SQLite persistence: reads and writes (evidence: `server.js`)
- Clinical notes → Encrypted SQLite persistence: stores encrypted notes (evidence: `README.md`)
- Account administration → Encrypted SQLite persistence: stores accounts (evidence: `server.js`)
- Audit events → Encrypted SQLite persistence: stores events (evidence: `README.md`)
- Encrypted backups → Encrypted SQLite persistence: backs up data (evidence: `README.md`)
