# mohdzakirmustafa2005/ai-gym-alaram architecture

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

- Interactive diagram: https://gitdiagram.com/mohdzakirmustafa2005/ai-gym-alaram
- Repository: https://github.com/mohdzakirmustafa2005/ai-gym-alaram

## Overview

GymAlarm AI is a fitness wake-up app. Users sign in, configure recurring alarms, complete a dismissal challenge, and earn wake-up activity and XP; the app also provides AI-generated motivation and workouts, coach chat, progress tracking, and rankings. The excerpts show the main component wiring and several Firestore and Gemini calls. Some component internals and the exact alarm-triggering logic are only partially excerpted, so the graph limits those relationships to what the excerpts or source index support.

Main entry points: [`src/App.tsx`](https://github.com/mohdzakirmustafa2005/ai-gym-alaram/blob/main/src/App.tsx) (App Shell), [`src/services/geminiService.ts`](https://github.com/mohdzakirmustafa2005/ai-gym-alaram/blob/main/src/services/geminiService.ts) (Gemini Service), [`src/components/AlarmOverlay.tsx`](https://github.com/mohdzakirmustafa2005/ai-gym-alaram/blob/main/src/components/AlarmOverlay.tsx) (Alarm Challenge), [`src/firebase.ts`](https://github.com/mohdzakirmustafa2005/ai-gym-alaram/blob/main/src/firebase.ts) (Firebase Client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["App Shell"]
  node_bootstrap["React Bootstrap<br/>[main.tsx]"]
  node_app_shell["App Shell<br/>[App.tsx]"]
end

subgraph group_alarms["Alarm Workflow"]
  node_alarm_page["Alarm Manager<br/>[AlarmPage.tsx]"]
  node_alarm_overlay["Alarm Challenge<br/>[AlarmOverlay.tsx]"]
end

subgraph group_fitness["Fitness Features"]
  node_dashboard["Dashboard<br/>[Dashboard.tsx]"]
  node_ai_coach["AI Coach Chat<br/>[AICoach.tsx]"]
  node_progress["Progress Tracker"]
  node_leaderboard["Leaderboard<br/>[Leaderboard.tsx]"]
end

subgraph group_platform["Cloud Services"]
  node_gemini_service["Gemini Service<br/>[geminiService.ts]"]
  node_firebase_client["Firebase Client<br/>[firebase.ts]"]
  node_firebase_auth["Firebase Auth"]
  node_firestore[("Cloud Firestore")]
  node_gemini_api["Gemini API"]
end

node_user(("User"))

node_user -->|"opens app"| node_bootstrap
node_bootstrap -->|"renders"| node_app_shell
node_user -->|"uses"| node_app_shell
node_app_shell -->|"uses auth"| node_firebase_client
node_firebase_client -->|"initializes"| node_firebase_auth
node_firebase_client -->|"initializes"| node_firestore
node_app_shell -->|"reads and writes"| node_firestore
node_app_shell -->|"renders"| node_alarm_page
node_app_shell -->|"renders"| node_dashboard
node_app_shell -->|"renders"| node_ai_coach
node_app_shell -->|"renders"| node_progress
node_app_shell -->|"renders"| node_leaderboard
node_app_shell -->|"renders"| node_alarm_overlay
node_alarm_page -->|"manages alarms"| node_firestore
node_alarm_overlay -->|"records wake"| node_firestore
node_alarm_overlay -->|"requests selfie check"| node_gemini_service
node_dashboard -->|"requests motivation and workout"| node_gemini_service
node_ai_coach -->|"sends chat"| node_gemini_service
node_progress -->|"reads activity logs"| node_firestore
node_leaderboard -->|"reads rankings"| node_firestore
node_gemini_service -->|"requests generation"| node_gemini_api

click node_bootstrap "https://github.com/mohdzakirmustafa2005/ai-gym-alaram/blob/main/src/main.tsx"
click node_app_shell "https://github.com/mohdzakirmustafa2005/ai-gym-alaram/blob/main/src/App.tsx"
click node_alarm_page "https://github.com/mohdzakirmustafa2005/ai-gym-alaram/blob/main/src/components/AlarmPage.tsx"
click node_alarm_overlay "https://github.com/mohdzakirmustafa2005/ai-gym-alaram/blob/main/src/components/AlarmOverlay.tsx"
click node_dashboard "https://github.com/mohdzakirmustafa2005/ai-gym-alaram/blob/main/src/components/Dashboard.tsx"
click node_ai_coach "https://github.com/mohdzakirmustafa2005/ai-gym-alaram/blob/main/src/components/AICoach.tsx"
click node_progress "https://github.com/mohdzakirmustafa2005/ai-gym-alaram/blob/main/src/components/ProgressTracker.tsx"
click node_leaderboard "https://github.com/mohdzakirmustafa2005/ai-gym-alaram/blob/main/src/components/Leaderboard.tsx"
click node_gemini_service "https://github.com/mohdzakirmustafa2005/ai-gym-alaram/blob/main/src/services/geminiService.ts"
click node_firebase_client "https://github.com/mohdzakirmustafa2005/ai-gym-alaram/blob/main/src/firebase.ts"

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_bootstrap,node_app_shell,node_user toneBlue
class node_alarm_page,node_alarm_overlay toneAmber
class node_dashboard,node_ai_coach,node_progress,node_leaderboard toneMint
class node_gemini_service,node_firebase_client,node_firebase_auth,node_firestore,node_gemini_api toneRose
```

## Components

### App Shell

- [React Bootstrap](https://github.com/mohdzakirmustafa2005/ai-gym-alaram/blob/main/src/main.tsx): `src/main.tsx`
- [App Shell](https://github.com/mohdzakirmustafa2005/ai-gym-alaram/blob/main/src/App.tsx): `src/App.tsx`

### Alarm Workflow

- [Alarm Manager](https://github.com/mohdzakirmustafa2005/ai-gym-alaram/blob/main/src/components/AlarmPage.tsx): `src/components/AlarmPage.tsx`
- [Alarm Challenge](https://github.com/mohdzakirmustafa2005/ai-gym-alaram/blob/main/src/components/AlarmOverlay.tsx): `src/components/AlarmOverlay.tsx`

### Fitness Features

- [Dashboard](https://github.com/mohdzakirmustafa2005/ai-gym-alaram/blob/main/src/components/Dashboard.tsx): `src/components/Dashboard.tsx`
- [AI Coach Chat](https://github.com/mohdzakirmustafa2005/ai-gym-alaram/blob/main/src/components/AICoach.tsx): `src/components/AICoach.tsx`
- [Progress Tracker](https://github.com/mohdzakirmustafa2005/ai-gym-alaram/blob/main/src/components/ProgressTracker.tsx): `src/components/ProgressTracker.tsx`
- [Leaderboard](https://github.com/mohdzakirmustafa2005/ai-gym-alaram/blob/main/src/components/Leaderboard.tsx): `src/components/Leaderboard.tsx`

### Cloud Services

- [Gemini Service](https://github.com/mohdzakirmustafa2005/ai-gym-alaram/blob/main/src/services/geminiService.ts): `src/services/geminiService.ts`
- [Firebase Client](https://github.com/mohdzakirmustafa2005/ai-gym-alaram/blob/main/src/firebase.ts): `src/firebase.ts`
- **Firebase Auth**
- **Cloud Firestore**
- **Gemini API**

### Other components

- **User**

## Connections

- User → React Bootstrap: opens app (evidence: `src/main.tsx`)
- React Bootstrap → App Shell: renders (evidence: `src/main.tsx`)
- User → App Shell: uses (evidence: `src/App.tsx`)
- App Shell → Firebase Client: uses auth (evidence: `src/App.tsx`)
- Firebase Client → Firebase Auth: initializes (evidence: `src/firebase.ts`)
- Firebase Client → Cloud Firestore: initializes (evidence: `src/firebase.ts`)
- App Shell → Cloud Firestore: reads and writes (evidence: `src/App.tsx`)
- App Shell → Alarm Manager: renders (evidence: `src/App.tsx`)
- App Shell → Dashboard: renders (evidence: `src/App.tsx`)
- App Shell → AI Coach Chat: renders (evidence: `src/App.tsx`)
- App Shell → Progress Tracker: renders (evidence: `src/App.tsx`)
- App Shell → Leaderboard: renders (evidence: `src/App.tsx`)
- App Shell → Alarm Challenge: renders (evidence: `src/App.tsx`)
- Alarm Manager → Cloud Firestore: manages alarms (evidence: `src/components/AlarmPage.tsx`)
- Alarm Challenge → Cloud Firestore: records wake (evidence: `src/components/AlarmOverlay.tsx`)
- Alarm Challenge → Gemini Service: requests selfie check (evidence: `src/components/AlarmOverlay.tsx`)
- Dashboard → Gemini Service: requests motivation and workout (evidence: `src/components/Dashboard.tsx`)
- AI Coach Chat → Gemini Service: sends chat (evidence: `src/components/AICoach.tsx`)
- Progress Tracker → Cloud Firestore: reads activity logs (evidence: `src/components/ProgressTracker.tsx`)
- Leaderboard → Cloud Firestore: reads rankings (evidence: `src/components/Leaderboard.tsx`)
- Gemini Service → Gemini API: requests generation (evidence: `src/services/geminiService.ts`)
