# donthamgopinathreddy-jpg/cotrainr architecture

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

- Interactive diagram: https://gitdiagram.com/donthamgopinathreddy-jpg/cotrainr
- Repository: https://github.com/donthamgopinathreddy-jpg/cotrainr

## Overview

Cotrainr is a Flutter fitness and wellness app for clients, trainers, and nutritionists, combining fitness consistency, guidance, tracking, and community. The documented user journey begins with sign-in, then branches into discovering providers and requesting connections, and using the app’s quest, social, and profile areas. Sampled backend functions support lead handling, entitlements, video sessions, Zoom account connection, and push delivery. The README describes additional app capabilities, but Flutter source is absent from the supplied tree, so their internal wiring cannot be verified; those branches are shown at documented directory level.

Main entry points: [`lib`](https://github.com/donthamgopinathreddy-jpg/cotrainr/tree/main/lib) (Cotrainr app), [`lib/pages/home`](https://github.com/donthamgopinathreddy-jpg/cotrainr/tree/main/lib/pages/home) (Home navigation), [`supabase/functions/create-video-session/index.ts`](https://github.com/donthamgopinathreddy-jpg/cotrainr/blob/main/supabase/functions/create-video-session/index.ts) (Video sessions), [`supabase/functions/zoom-oauth-callback/index.ts`](https://github.com/donthamgopinathreddy-jpg/cotrainr/blob/main/supabase/functions/zoom-oauth-callback/index.ts) (Zoom connect callback)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_mobile["Mobile app"]
  node_app["Cotrainr app"]
  node_auth["Sign-in and signup"]
  node_home["Home navigation"]
end

subgraph group_engagement["Fitness and community"]
  node_discover["Provider discovery"]
  node_quests["Quests and challenges"]
  node_social["Social feed"]
  node_profile["User profile"]
end

subgraph group_backend["Supabase services"]
  node_leads["Provider leads<br/>[index.ts]"]
  node_leadstatus["Lead status<br/>[index.ts]"]
  node_entitlements["Plan entitlements<br/>[index.ts]"]
  node_sessions["Video sessions<br/>[index.ts]"]
  node_zoomstart["Zoom connect start<br/>[index.ts]"]
  node_zoomcallback["Zoom connect callback<br/>[index.ts]"]
  node_zoomdisconnect["Zoom disconnect<br/>[index.ts]"]
  node_push["Push delivery<br/>[index.ts]"]
  node_signedurl["Verification file links<br/>[index.ts]"]
end

subgraph group_integrations["External integrations"]
  node_database[("Supabase database")]
  node_storage[("Supabase Storage")]
  node_zoom["Zoom"]
  node_firebase["Firebase Cloud Messaging"]
end

node_client(("Client"))
node_trainer(("Trainer or nutritionist"))

node_client -->|"uses"| node_app
node_trainer -->|"uses"| node_app
node_app -->|"navigates"| node_auth
node_app -->|"opens"| node_home
node_home -->|"navigates"| node_discover
node_home -->|"navigates"| node_quests
node_home -->|"navigates"| node_social
node_home -->|"navigates"| node_profile
node_auth -->|"authenticates via"| node_database
node_discover -.->|"creates request"| node_leads
node_leads -->|"calls RPC"| node_database
node_leadstatus -->|"calls RPC"| node_database
node_app -.->|"updates lead"| node_leadstatus
node_app -.->|"requests limits"| node_entitlements
node_entitlements -->|"reads plans"| node_database
node_app -.->|"creates session"| node_sessions
node_sessions -->|"writes session"| node_database
node_sessions -.->|"creates meeting"| node_zoom
node_app -->|"requests auth URL"| node_zoomstart
node_zoomstart -.->|"redirects via OAuth"| node_zoomcallback
node_zoomcallback -->|"exchanges code"| node_zoom
node_zoomcallback -->|"stores tokens"| node_database
node_app -.->|"disconnects account"| node_zoomdisconnect
node_zoomdisconnect -->|"deletes tokens"| node_database
node_push -->|"reads preferences"| node_database
node_push -->|"sends messages"| node_firebase
node_app -.->|"requests link"| node_signedurl
node_signedurl -->|"creates signed URL"| node_storage

click node_app "https://github.com/donthamgopinathreddy-jpg/cotrainr/tree/main/lib"
click node_auth "https://github.com/donthamgopinathreddy-jpg/cotrainr/tree/main/lib/pages/auth"
click node_home "https://github.com/donthamgopinathreddy-jpg/cotrainr/tree/main/lib/pages/home"
click node_discover "https://github.com/donthamgopinathreddy-jpg/cotrainr/tree/main/lib/pages/discover"
click node_leads "https://github.com/donthamgopinathreddy-jpg/cotrainr/blob/main/supabase/functions/create-lead/index.ts"
click node_leadstatus "https://github.com/donthamgopinathreddy-jpg/cotrainr/blob/main/supabase/functions/update-lead-status/index.ts"
click node_quests "https://github.com/donthamgopinathreddy-jpg/cotrainr/tree/main/lib/pages/quest"
click node_social "https://github.com/donthamgopinathreddy-jpg/cotrainr/tree/main/lib/pages/cocircle"
click node_profile "https://github.com/donthamgopinathreddy-jpg/cotrainr/tree/main/lib/pages/profile"
click node_entitlements "https://github.com/donthamgopinathreddy-jpg/cotrainr/blob/main/supabase/functions/get-entitlements/index.ts"
click node_sessions "https://github.com/donthamgopinathreddy-jpg/cotrainr/blob/main/supabase/functions/create-video-session/index.ts"
click node_zoomstart "https://github.com/donthamgopinathreddy-jpg/cotrainr/blob/main/supabase/functions/zoom-oauth-start/index.ts"
click node_zoomcallback "https://github.com/donthamgopinathreddy-jpg/cotrainr/blob/main/supabase/functions/zoom-oauth-callback/index.ts"
click node_zoomdisconnect "https://github.com/donthamgopinathreddy-jpg/cotrainr/blob/main/supabase/functions/zoom-disconnect/index.ts"
click node_push "https://github.com/donthamgopinathreddy-jpg/cotrainr/blob/main/supabase/functions/send-push-notification/index.ts"
click node_signedurl "https://github.com/donthamgopinathreddy-jpg/cotrainr/blob/main/supabase/functions/get-verification-signed-url/index.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_app,node_auth,node_home,node_client toneBlue
class node_discover,node_quests,node_social,node_profile toneAmber
class node_leads,node_leadstatus,node_entitlements,node_sessions,node_zoomstart,node_zoomcallback,node_zoomdisconnect,node_push,node_signedurl toneMint
class node_database,node_storage,node_zoom,node_firebase toneRose
class node_trainer toneIndigo
```

## Components

### Mobile app

- [Cotrainr app](https://github.com/donthamgopinathreddy-jpg/cotrainr/tree/main/lib): `lib`
- [Sign-in and signup](https://github.com/donthamgopinathreddy-jpg/cotrainr/tree/main/lib/pages/auth): `lib/pages/auth`
- [Home navigation](https://github.com/donthamgopinathreddy-jpg/cotrainr/tree/main/lib/pages/home): `lib/pages/home`

### Fitness and community

- [Provider discovery](https://github.com/donthamgopinathreddy-jpg/cotrainr/tree/main/lib/pages/discover): `lib/pages/discover`
- [Quests and challenges](https://github.com/donthamgopinathreddy-jpg/cotrainr/tree/main/lib/pages/quest): `lib/pages/quest`
- [Social feed](https://github.com/donthamgopinathreddy-jpg/cotrainr/tree/main/lib/pages/cocircle): `lib/pages/cocircle`
- [User profile](https://github.com/donthamgopinathreddy-jpg/cotrainr/tree/main/lib/pages/profile): `lib/pages/profile`

### Supabase services

- [Provider leads](https://github.com/donthamgopinathreddy-jpg/cotrainr/blob/main/supabase/functions/create-lead/index.ts): `supabase/functions/create-lead/index.ts`
- [Lead status](https://github.com/donthamgopinathreddy-jpg/cotrainr/blob/main/supabase/functions/update-lead-status/index.ts): `supabase/functions/update-lead-status/index.ts`
- [Plan entitlements](https://github.com/donthamgopinathreddy-jpg/cotrainr/blob/main/supabase/functions/get-entitlements/index.ts): `supabase/functions/get-entitlements/index.ts`
- [Video sessions](https://github.com/donthamgopinathreddy-jpg/cotrainr/blob/main/supabase/functions/create-video-session/index.ts): `supabase/functions/create-video-session/index.ts`
- [Zoom connect start](https://github.com/donthamgopinathreddy-jpg/cotrainr/blob/main/supabase/functions/zoom-oauth-start/index.ts): `supabase/functions/zoom-oauth-start/index.ts`
- [Zoom connect callback](https://github.com/donthamgopinathreddy-jpg/cotrainr/blob/main/supabase/functions/zoom-oauth-callback/index.ts): `supabase/functions/zoom-oauth-callback/index.ts`
- [Zoom disconnect](https://github.com/donthamgopinathreddy-jpg/cotrainr/blob/main/supabase/functions/zoom-disconnect/index.ts): `supabase/functions/zoom-disconnect/index.ts`
- [Push delivery](https://github.com/donthamgopinathreddy-jpg/cotrainr/blob/main/supabase/functions/send-push-notification/index.ts): `supabase/functions/send-push-notification/index.ts`
- [Verification file links](https://github.com/donthamgopinathreddy-jpg/cotrainr/blob/main/supabase/functions/get-verification-signed-url/index.ts): `supabase/functions/get-verification-signed-url/index.ts`

### External integrations

- **Supabase database**
- **Supabase Storage**
- **Zoom**
- **Firebase Cloud Messaging**

### Other components

- **Client**
- **Trainer or nutritionist**

## Connections

- Client → Cotrainr app: uses
- Trainer or nutritionist → Cotrainr app: uses
- Cotrainr app → Sign-in and signup: navigates
- Cotrainr app → Home navigation: opens
- Home navigation → Provider discovery: navigates
- Home navigation → Quests and challenges: navigates
- Home navigation → Social feed: navigates
- Home navigation → User profile: navigates
- Sign-in and signup → Supabase database: authenticates via
- Provider discovery → Provider leads: creates request
- Provider leads → Supabase database: calls RPC
- Lead status → Supabase database: calls RPC
- Cotrainr app → Lead status: updates lead
- Cotrainr app → Plan entitlements: requests limits
- Plan entitlements → Supabase database: reads plans
- Cotrainr app → Video sessions: creates session
- Video sessions → Supabase database: writes session
- Video sessions → Zoom: creates meeting
- Cotrainr app → Zoom connect start: requests auth URL
- Zoom connect start → Zoom connect callback: redirects via OAuth
- Zoom connect callback → Zoom: exchanges code
- Zoom connect callback → Supabase database: stores tokens
- Cotrainr app → Zoom disconnect: disconnects account
- Zoom disconnect → Supabase database: deletes tokens
- Push delivery → Supabase database: reads preferences
- Push delivery → Firebase Cloud Messaging: sends messages
- Cotrainr app → Verification file links: requests link
- Verification file links → Supabase Storage: creates signed URL
