# nevfel-gul/pt_react_native architecture

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

- Interactive diagram: https://gitdiagram.com/nevfel-gul/pt_react_native
- Repository: https://github.com/nevfel-gul/pt_react_native

## Overview

This appears to be a personal-training app for managing clients and their fitness assessments. The main workflow is to create a student, add assessment records, and review those records and the student’s progress. The app also includes calendar, analytics, premium access, promotions, AI features, and reminder functions. The README is only the Expo starter template, so these capabilities are inferred from the supplied tree and excerpts; links for unsampled screens and backend jobs are omitted where their wiring is unclear.

Main entry points: [`services/firestorePaths.ts`](https://github.com/nevfel-gul/pt_react_native/blob/main/services/firestorePaths.ts) (Firestore paths), [`constants/PremiumContext.tsx`](https://github.com/nevfel-gul/pt_react_native/blob/main/constants/PremiumContext.tsx) (Premium state), [`app/(tabs)/index.tsx`](https://github.com/nevfel-gul/pt_react_native/blob/main/app/(tabs)/index.tsx) (Student list), [`app/student/[id].tsx`](https://github.com/nevfel-gul/pt_react_native/blob/main/app/student/%5Bid%5D.tsx) (Student progress)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Trainer app"]
  node_login["Sign in<br/>[login.tsx]"]
  node_home["Student list<br/>[index.tsx]"]
  node_calendar["Calendar<br/>[calendar.tsx]"]
  node_analytics["Analytics<br/>[analiz.tsx]"]
  node_ai_ui["AI student chat"]
  node_premium_screen["Premium screen<br/>[premium.tsx]"]
end

subgraph group_data["Client records"]
  node_student_form["Student form<br/>[newstudent.tsx]"]
  node_student_detail["Student progress<br/>[&#91;id&#93;.tsx]"]
  node_record_form["Assessment form<br/>[&#91;id&#93;.tsx]"]
  node_record_detail["Assessment detail<br/>[&#91;id&#93;.tsx]"]
  node_firestore_paths["Firestore paths<br/>[firestorePaths.ts]"]
end

subgraph group_backend["Cloud services"]
  node_firebase["Firebase services<br/>[firebase.js]"]
  node_ai_client["AI client<br/>[aiClient.ts]"]
  node_functions["Callable functions<br/>[index.ts]"]
  node_push_jobs["Reminder jobs"]
  node_push_sender["Push sender<br/>[push.ts]"]
end

subgraph group_access["Premium and promos"]
  node_premium["Premium state<br/>[PremiumContext.tsx]"]
  node_promo_context["Promo state<br/>[PromoContext.tsx]"]
  node_promo_client["Promo client<br/>[promo.ts]"]
  node_promo_backend["Promo functions<br/>[promo.ts]"]
  node_admin["Promo administration<br/>[promoAdmin.ts]"]
end

node_trainer(("Trainer"))
node_firestore[("Firestore")]
node_openai["OpenAI"]
node_notifications["Push service"]

node_trainer -->|"signs in"| node_login
node_trainer -->|"manages clients"| node_home
node_home -->|"queries collections"| node_firestore_paths
node_home -->|"opens profile"| node_student_detail
node_student_form -->|"uses paths"| node_firestore_paths
node_record_form -->|"uses paths"| node_firestore_paths
node_record_form -->|"writes assessment"| node_firestore
node_student_detail -->|"uses paths"| node_firestore_paths
node_student_detail -->|"reads progress"| node_firestore
node_record_detail -->|"uses paths"| node_firestore_paths
node_record_detail -->|"reads assessment"| node_firestore
node_firestore_paths -->|"resolves references"| node_firestore
node_calendar -.->|"reads schedule"| node_firestore
node_analytics -.->|"reads metrics"| node_firestore
node_ai_ui -.->|"requests AI"| node_ai_client
node_ai_client -->|"calls function"| node_firebase
node_firebase -->|"dispatches callable"| node_functions
node_functions -->|"requests completion"| node_openai
node_functions -->|"reads users"| node_firestore
node_push_jobs -.->|"sends reminders"| node_push_sender
node_push_sender -->|"delivers pushes"| node_notifications
node_premium -->|"uses auth and database"| node_firebase
node_premium -->|"listens and saves"| node_firestore
node_premium_screen -->|"shows access"| node_premium
node_promo_context -->|"checks entitlement"| node_premium
node_promo_context -->|"requests coupon"| node_promo_client
node_promo_client -.->|"calls promo service"| node_promo_backend
node_promo_backend -->|"manages coupons"| node_firestore
node_admin -.->|"manages campaigns"| node_firestore

click node_login "https://github.com/nevfel-gul/pt_react_native/blob/main/app/login.tsx"
click node_home "https://github.com/nevfel-gul/pt_react_native/blob/main/app/(tabs)/index.tsx"
click node_calendar "https://github.com/nevfel-gul/pt_react_native/blob/main/app/(tabs)/calendar.tsx"
click node_analytics "https://github.com/nevfel-gul/pt_react_native/blob/main/app/(tabs)/analiz.tsx"
click node_student_form "https://github.com/nevfel-gul/pt_react_native/blob/main/app/newstudent.tsx"
click node_student_detail "https://github.com/nevfel-gul/pt_react_native/blob/main/app/student/%5Bid%5D.tsx"
click node_record_form "https://github.com/nevfel-gul/pt_react_native/blob/main/app/newrecord/%5Bid%5D.tsx"
click node_record_detail "https://github.com/nevfel-gul/pt_react_native/blob/main/app/record/%5Bid%5D.tsx"
click node_firestore_paths "https://github.com/nevfel-gul/pt_react_native/blob/main/services/firestorePaths.ts"
click node_firebase "https://github.com/nevfel-gul/pt_react_native/blob/main/services/firebase.js"
click node_ai_ui "https://github.com/nevfel-gul/pt_react_native/blob/main/components/AiStudentSearchUI.tsx"
click node_ai_client "https://github.com/nevfel-gul/pt_react_native/blob/main/services/aiClient.ts"
click node_functions "https://github.com/nevfel-gul/pt_react_native/blob/main/functions/src/index.ts"
click node_push_jobs "https://github.com/nevfel-gul/pt_react_native/tree/main/functions/src/jobs"
click node_push_sender "https://github.com/nevfel-gul/pt_react_native/blob/main/functions/src/push.ts"
click node_premium "https://github.com/nevfel-gul/pt_react_native/blob/main/constants/PremiumContext.tsx"
click node_premium_screen "https://github.com/nevfel-gul/pt_react_native/blob/main/app/(tabs)/premium.tsx"
click node_promo_context "https://github.com/nevfel-gul/pt_react_native/blob/main/constants/PromoContext.tsx"
click node_promo_client "https://github.com/nevfel-gul/pt_react_native/blob/main/services/promo.ts"
click node_promo_backend "https://github.com/nevfel-gul/pt_react_native/blob/main/functions/src/promo/promo.ts"
click node_admin "https://github.com/nevfel-gul/pt_react_native/blob/main/functions/src/admin/promoAdmin.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_login,node_home,node_calendar,node_analytics,node_ai_ui,node_premium_screen toneBlue
class node_student_form,node_student_detail,node_record_form,node_record_detail,node_firestore_paths,node_firestore toneAmber
class node_firebase,node_ai_client,node_functions,node_push_jobs,node_push_sender toneMint
class node_premium,node_promo_context,node_promo_client,node_promo_backend,node_admin toneRose
class node_trainer,node_openai,node_notifications toneIndigo
```

## Components

### Trainer app

- [Sign in](https://github.com/nevfel-gul/pt_react_native/blob/main/app/login.tsx): `app/login.tsx`
- [Student list](https://github.com/nevfel-gul/pt_react_native/blob/main/app/(tabs)/index.tsx): `app/(tabs)/index.tsx`
- [Calendar](https://github.com/nevfel-gul/pt_react_native/blob/main/app/(tabs)/calendar.tsx): `app/(tabs)/calendar.tsx`
- [Analytics](https://github.com/nevfel-gul/pt_react_native/blob/main/app/(tabs)/analiz.tsx): `app/(tabs)/analiz.tsx`
- [AI student chat](https://github.com/nevfel-gul/pt_react_native/blob/main/components/AiStudentSearchUI.tsx): `components/AiStudentSearchUI.tsx`
- [Premium screen](https://github.com/nevfel-gul/pt_react_native/blob/main/app/(tabs)/premium.tsx): `app/(tabs)/premium.tsx`

### Client records

- [Student form](https://github.com/nevfel-gul/pt_react_native/blob/main/app/newstudent.tsx): `app/newstudent.tsx`
- [Student progress](https://github.com/nevfel-gul/pt_react_native/blob/main/app/student/%5Bid%5D.tsx): `app/student/[id].tsx`
- [Assessment form](https://github.com/nevfel-gul/pt_react_native/blob/main/app/newrecord/%5Bid%5D.tsx): `app/newrecord/[id].tsx`
- [Assessment detail](https://github.com/nevfel-gul/pt_react_native/blob/main/app/record/%5Bid%5D.tsx): `app/record/[id].tsx`
- [Firestore paths](https://github.com/nevfel-gul/pt_react_native/blob/main/services/firestorePaths.ts): `services/firestorePaths.ts`

### Cloud services

- [Firebase services](https://github.com/nevfel-gul/pt_react_native/blob/main/services/firebase.js): `services/firebase.js`
- [AI client](https://github.com/nevfel-gul/pt_react_native/blob/main/services/aiClient.ts): `services/aiClient.ts`
- [Callable functions](https://github.com/nevfel-gul/pt_react_native/blob/main/functions/src/index.ts): `functions/src/index.ts`
- [Reminder jobs](https://github.com/nevfel-gul/pt_react_native/tree/main/functions/src/jobs): `functions/src/jobs`
- [Push sender](https://github.com/nevfel-gul/pt_react_native/blob/main/functions/src/push.ts): `functions/src/push.ts`

### Premium and promos

- [Premium state](https://github.com/nevfel-gul/pt_react_native/blob/main/constants/PremiumContext.tsx): `constants/PremiumContext.tsx`
- [Promo state](https://github.com/nevfel-gul/pt_react_native/blob/main/constants/PromoContext.tsx): `constants/PromoContext.tsx`
- [Promo client](https://github.com/nevfel-gul/pt_react_native/blob/main/services/promo.ts): `services/promo.ts`
- [Promo functions](https://github.com/nevfel-gul/pt_react_native/blob/main/functions/src/promo/promo.ts): `functions/src/promo/promo.ts`
- [Promo administration](https://github.com/nevfel-gul/pt_react_native/blob/main/functions/src/admin/promoAdmin.ts): `functions/src/admin/promoAdmin.ts`

### Other components

- **Trainer**
- **Firestore**
- **OpenAI**
- **Push service**

## Connections

- Trainer → Sign in: signs in
- Trainer → Student list: manages clients
- Student list → Firestore paths: queries collections
- Student list → Student progress: opens profile
- Student form → Firestore paths: uses paths
- Assessment form → Firestore paths: uses paths
- Assessment form → Firestore: writes assessment
- Student progress → Firestore paths: uses paths
- Student progress → Firestore: reads progress
- Assessment detail → Firestore paths: uses paths
- Assessment detail → Firestore: reads assessment
- Firestore paths → Firestore: resolves references
- Calendar → Firestore: reads schedule
- Analytics → Firestore: reads metrics
- AI student chat → AI client: requests AI
- AI client → Firebase services: calls function
- Firebase services → Callable functions: dispatches callable
- Callable functions → OpenAI: requests completion
- Callable functions → Firestore: reads users
- Reminder jobs → Push sender: sends reminders
- Push sender → Push service: delivers pushes
- Premium state → Firebase services: uses auth and database
- Premium state → Firestore: listens and saves
- Premium screen → Premium state: shows access
- Promo state → Premium state: checks entitlement
- Promo state → Promo client: requests coupon
- Promo client → Promo functions: calls promo service
- Promo functions → Firestore: manages coupons
- Promo administration → Firestore: manages campaigns
