# appleflash/gym-tracker architecture

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

- Interactive diagram: https://gitdiagram.com/appleflash/gym-tracker
- Repository: https://github.com/appleflash/gym-tracker

## Overview

СИЛОВОЙ ДНЕВНИК is an installable workout-tracking PWA. Its documented user workflow is to open it in Safari, add it to the iPhone Home Screen, then use locally stored data and export/import JSON backups. The service worker caches the app shell and serves the cached page when navigation fails. The AI proxy is shown as a separate integration: its endpoint calls Gemini, but the sampled files do not show the app calling the proxy. App internals are not sampled, so their relationships are based on the README.

Main entry points: [`index.html`](https://github.com/appleflash/gym-tracker/blob/main/index.html) (Workout PWA), [`sw.js`](https://github.com/appleflash/gym-tracker/blob/main/sw.js) (Service worker), [`proxy/api/chat.js`](https://github.com/appleflash/gym-tracker/blob/main/proxy/api/chat.js) (Chat proxy), [`manifest.webmanifest`](https://github.com/appleflash/gym-tracker/blob/main/manifest.webmanifest) (PWA manifest)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Workout app"]
  node_app["Workout PWA<br/>[index.html]"]
  node_local[("Local workout data<br/>[index.html]")]
  node_backup["JSON backup<br/>[index.html]"]
end

subgraph group_offline["Offline support"]
  node_manifest["PWA manifest"]
  node_worker["Service worker<br/>[sw.js]"]
  node_cache[("Browser cache")]
end

subgraph group_ai["AI proxy"]
  node_proxy["Chat proxy<br/>[chat.js]"]
end

node_user(("iPhone user"))
node_gemini["Gemini API"]

node_user -->|"opens"| node_app
node_app -->|"stores locally"| node_local
node_app -->|"exports and imports"| node_backup
node_app -->|"installs as"| node_manifest
node_app -->|"uses offline cache"| node_worker
node_worker -->|"caches shell"| node_cache
node_worker -->|"serves cached page"| node_cache
node_proxy -->|"requests content"| node_gemini

click node_app "https://github.com/appleflash/gym-tracker/blob/main/index.html"
click node_local "https://github.com/appleflash/gym-tracker/blob/main/index.html"
click node_backup "https://github.com/appleflash/gym-tracker/blob/main/index.html"
click node_manifest "https://github.com/appleflash/gym-tracker/blob/main/manifest.webmanifest"
click node_worker "https://github.com/appleflash/gym-tracker/blob/main/sw.js"
click node_proxy "https://github.com/appleflash/gym-tracker/blob/main/proxy/api/chat.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_app,node_local,node_backup,node_user toneBlue
class node_manifest,node_worker,node_cache toneAmber
class node_proxy,node_gemini toneMint
```

## Components

### Workout app

- [Workout PWA](https://github.com/appleflash/gym-tracker/blob/main/index.html): `index.html`
- [Local workout data](https://github.com/appleflash/gym-tracker/blob/main/index.html): `index.html`
- [JSON backup](https://github.com/appleflash/gym-tracker/blob/main/index.html): `index.html`

### Offline support

- [PWA manifest](https://github.com/appleflash/gym-tracker/blob/main/manifest.webmanifest): `manifest.webmanifest`
- [Service worker](https://github.com/appleflash/gym-tracker/blob/main/sw.js): `sw.js`
- **Browser cache**

### AI proxy

- [Chat proxy](https://github.com/appleflash/gym-tracker/blob/main/proxy/api/chat.js): `proxy/api/chat.js`

### Other components

- **iPhone user**
- **Gemini API**

## Connections

- iPhone user → Workout PWA: opens (evidence: `README.txt`)
- Workout PWA → Local workout data: stores locally (evidence: `README.txt`)
- Workout PWA → JSON backup: exports and imports (evidence: `README.txt`)
- Workout PWA → PWA manifest: installs as (evidence: `README.txt`)
- Workout PWA → Service worker: uses offline cache (evidence: `README.txt`)
- Service worker → Browser cache: caches shell (evidence: `sw.js`)
- Service worker → Browser cache: serves cached page (evidence: `sw.js`)
- Chat proxy → Gemini API: requests content (evidence: `proxy/api/chat.js`)
