# capchris20/7th-project--coach-connect architecture

> Architecture diagram of the GitHub repository capchris20/7th-project--coach-connect, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/capchris20/7th-project--coach-connect
- Repository: https://github.com/capchris20/7th-project--coach-connect

## Overview

Coach Connect is a mobile fitness and wellness app connecting clients with trainers, with nutrition tracking, workout planning, messaging, scheduling, shared files, payments, and an AI coach. The client workflow begins with app startup and shared Firebase setup, then moves through role-specific navigation into features such as food search and daily logging. The repository also has an Express backend and Firebase functions. Source excerpts support only a subset of runtime connections; other major product areas are shown without inferred call relationships.

Main entry points: [`src/app-start/ClientAppStart.js`](https://github.com/capchris20/7th-project--coach-connect/blob/main/src/app-start/ClientAppStart.js) (App startup), [`src/client-app/navigation/ClientMainScreen.jsx`](https://github.com/capchris20/7th-project--coach-connect/blob/main/src/client-app/navigation/ClientMainScreen.jsx) (Client navigation), [`server/lib/aiCoach/coachRequestHandler.js`](https://github.com/capchris20/7th-project--coach-connect/blob/main/server/lib/aiCoach/coachRequestHandler.js) (Coach request handler), [`src/nutrition/food-search/FoodSearchScreen.js`](https://github.com/capchris20/7th-project--coach-connect/blob/main/src/nutrition/food-search/FoodSearchScreen.js) (Food search)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Client app"]
  node_startup["App startup<br/>[ClientAppStart.js]"]
  node_clientnav["Client navigation"]
  node_home["Client home"]
  node_foodsearch["Food search"]
  node_foodtitles["Food result cleanup<br/>[tidyFoodTitles.js]"]
  node_dailylog["Daily food log"]
  node_savefood["Save logged food<br/>[saveLoggedFood.js]"]
end

subgraph group_coach["AI coaching"]
  node_coachhome["Coach home"]
  node_conversation["Coach conversation"]
  node_actionguard["Action confirmation rules<br/>[shouldAskFirst.js]"]
end

subgraph group_backend["Backend services"]
  node_server["Express API<br/>[index.js]"]
  node_foodapi["Food API routes<br/>[foodRoutes.js]"]
  node_coachhandler["Coach request handler"]
  node_websearch["Coach web search<br/>[coachWebSearch.js]"]
  node_llm["LLM providers"]
  node_functions["Firebase functions<br/>[index.js]"]
end

subgraph group_trainer["Trainer tools"]
  node_trainer["Trainer app"]
end

subgraph group_shared["Shared app services"]
  node_firebase["Firebase connection<br/>[cloudConnection.js]"]
  node_files["Shared file handling<br/>[AddFilePopup.js]"]
  node_header["Shared header<br/>[TopHeader.js]"]
  node_navlayout["Navigation layout"]
end

node_user(("Client or trainer"))

node_user -->|"opens app"| node_startup
node_startup -->|"uses shared setup"| node_firebase
node_startup -->|"loads home data"| node_home
node_startup -.->|"starts client shell"| node_clientnav
node_clientnav -.->|"shows home"| node_home
node_clientnav -->|"positions navigation"| node_navlayout
node_foodsearch -->|"cleans results"| node_foodtitles
node_foodsearch -->|"saves selected food"| node_savefood
node_dailylog -.->|"uses food logging"| node_savefood
node_coachhome -.->|"opens conversation"| node_conversation
node_conversation -->|"checks proposed actions"| node_actionguard
node_server -.->|"registers routes"| node_foodapi
node_server -.->|"dispatches requests"| node_coachhandler
node_coachhandler -->|"invokes search"| node_websearch
node_coachhandler -->|"calls providers"| node_llm
node_user -.->|"uses trainer tools"| node_trainer
node_user -.->|"shares files"| node_files
node_user -.->|"triggers services"| node_functions
node_header -.->|"shares shell layout"| node_navlayout

click node_startup "https://github.com/capchris20/7th-project--coach-connect/blob/main/src/app-start/ClientAppStart.js"
click node_firebase "https://github.com/capchris20/7th-project--coach-connect/blob/main/src/app-start/cloudConnection.js"
click node_clientnav "https://github.com/capchris20/7th-project--coach-connect/blob/main/src/client-app/navigation/ClientMainScreen.jsx"
click node_home "https://github.com/capchris20/7th-project--coach-connect/blob/main/src/client-app/home/TrainingHomeScreen.jsx"
click node_foodsearch "https://github.com/capchris20/7th-project--coach-connect/blob/main/src/nutrition/food-search/FoodSearchScreen.js"
click node_foodtitles "https://github.com/capchris20/7th-project--coach-connect/blob/main/src/nutrition/food-search/tidyFoodTitles.js"
click node_dailylog "https://github.com/capchris20/7th-project--coach-connect/blob/main/src/nutrition/daily-log/DailyLogContent.jsx"
click node_savefood "https://github.com/capchris20/7th-project--coach-connect/blob/main/src/nutrition/daily-log/saveLoggedFood.js"
click node_coachhome "https://github.com/capchris20/7th-project--coach-connect/blob/main/src/ai-coach/home-screen/CoachHomeScreen.jsx"
click node_conversation "https://github.com/capchris20/7th-project--coach-connect/blob/main/src/ai-coach/conversation/CoachConversationScreen.jsx"
click node_actionguard "https://github.com/capchris20/7th-project--coach-connect/blob/main/src/ai-coach/coach-actions/shouldAskFirst.js"
click node_server "https://github.com/capchris20/7th-project--coach-connect/blob/main/server/index.js"
click node_foodapi "https://github.com/capchris20/7th-project--coach-connect/blob/main/server/routes/foodRoutes.js"
click node_coachhandler "https://github.com/capchris20/7th-project--coach-connect/blob/main/server/lib/aiCoach/coachRequestHandler.js"
click node_websearch "https://github.com/capchris20/7th-project--coach-connect/blob/main/server/lib/coachWebSearch.js"
click node_llm "https://github.com/capchris20/7th-project--coach-connect/blob/main/server/lib/llm/coachLlmProviders.js"
click node_functions "https://github.com/capchris20/7th-project--coach-connect/blob/main/functions/index.js"
click node_trainer "https://github.com/capchris20/7th-project--coach-connect/blob/main/src/trainer-app/navigation/TrainerMainScreen.jsx"
click node_files "https://github.com/capchris20/7th-project--coach-connect/blob/main/src/for-both/files-and-notes/viewers/AddFilePopup.js"
click node_header "https://github.com/capchris20/7th-project--coach-connect/blob/main/src/for-both/loading-and-header/TopHeader.js"
click node_navlayout "https://github.com/capchris20/7th-project--coach-connect/blob/main/src/navigation/bottomMenuSpacing.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_startup,node_clientnav,node_home,node_foodsearch,node_foodtitles,node_dailylog,node_savefood,node_user toneBlue
class node_coachhome,node_conversation,node_actionguard toneAmber
class node_server,node_foodapi,node_coachhandler,node_websearch,node_llm,node_functions toneMint
class node_trainer toneRose
class node_firebase,node_files,node_header,node_navlayout toneIndigo
```

## Components

### Client app

- [App startup](https://github.com/capchris20/7th-project--coach-connect/blob/main/src/app-start/ClientAppStart.js): `src/app-start/ClientAppStart.js`
- [Client navigation](https://github.com/capchris20/7th-project--coach-connect/blob/main/src/client-app/navigation/ClientMainScreen.jsx): `src/client-app/navigation/ClientMainScreen.jsx`
- [Client home](https://github.com/capchris20/7th-project--coach-connect/blob/main/src/client-app/home/TrainingHomeScreen.jsx): `src/client-app/home/TrainingHomeScreen.jsx`
- [Food search](https://github.com/capchris20/7th-project--coach-connect/blob/main/src/nutrition/food-search/FoodSearchScreen.js): `src/nutrition/food-search/FoodSearchScreen.js`
- [Food result cleanup](https://github.com/capchris20/7th-project--coach-connect/blob/main/src/nutrition/food-search/tidyFoodTitles.js): `src/nutrition/food-search/tidyFoodTitles.js`
- [Daily food log](https://github.com/capchris20/7th-project--coach-connect/blob/main/src/nutrition/daily-log/DailyLogContent.jsx): `src/nutrition/daily-log/DailyLogContent.jsx`
- [Save logged food](https://github.com/capchris20/7th-project--coach-connect/blob/main/src/nutrition/daily-log/saveLoggedFood.js): `src/nutrition/daily-log/saveLoggedFood.js`

### AI coaching

- [Coach home](https://github.com/capchris20/7th-project--coach-connect/blob/main/src/ai-coach/home-screen/CoachHomeScreen.jsx): `src/ai-coach/home-screen/CoachHomeScreen.jsx`
- [Coach conversation](https://github.com/capchris20/7th-project--coach-connect/blob/main/src/ai-coach/conversation/CoachConversationScreen.jsx): `src/ai-coach/conversation/CoachConversationScreen.jsx`
- [Action confirmation rules](https://github.com/capchris20/7th-project--coach-connect/blob/main/src/ai-coach/coach-actions/shouldAskFirst.js): `src/ai-coach/coach-actions/shouldAskFirst.js`

### Backend services

- [Express API](https://github.com/capchris20/7th-project--coach-connect/blob/main/server/index.js): `server/index.js`
- [Food API routes](https://github.com/capchris20/7th-project--coach-connect/blob/main/server/routes/foodRoutes.js): `server/routes/foodRoutes.js`
- [Coach request handler](https://github.com/capchris20/7th-project--coach-connect/blob/main/server/lib/aiCoach/coachRequestHandler.js): `server/lib/aiCoach/coachRequestHandler.js`
- [Coach web search](https://github.com/capchris20/7th-project--coach-connect/blob/main/server/lib/coachWebSearch.js): `server/lib/coachWebSearch.js`
- [LLM providers](https://github.com/capchris20/7th-project--coach-connect/blob/main/server/lib/llm/coachLlmProviders.js): `server/lib/llm/coachLlmProviders.js`
- [Firebase functions](https://github.com/capchris20/7th-project--coach-connect/blob/main/functions/index.js): `functions/index.js`

### Trainer tools

- [Trainer app](https://github.com/capchris20/7th-project--coach-connect/blob/main/src/trainer-app/navigation/TrainerMainScreen.jsx): `src/trainer-app/navigation/TrainerMainScreen.jsx`

### Shared app services

- [Firebase connection](https://github.com/capchris20/7th-project--coach-connect/blob/main/src/app-start/cloudConnection.js): `src/app-start/cloudConnection.js`
- [Shared file handling](https://github.com/capchris20/7th-project--coach-connect/blob/main/src/for-both/files-and-notes/viewers/AddFilePopup.js): `src/for-both/files-and-notes/viewers/AddFilePopup.js`
- [Shared header](https://github.com/capchris20/7th-project--coach-connect/blob/main/src/for-both/loading-and-header/TopHeader.js): `src/for-both/loading-and-header/TopHeader.js`
- [Navigation layout](https://github.com/capchris20/7th-project--coach-connect/blob/main/src/navigation/bottomMenuSpacing.js): `src/navigation/bottomMenuSpacing.js`

### Other components

- **Client or trainer**

## Connections

- Client or trainer → App startup: opens app (evidence: `src/app-start/ClientAppStart.js`)
- App startup → Firebase connection: uses shared setup (evidence: `src/app-start/ClientAppStart.js`)
- App startup → Client home: loads home data (evidence: `src/app-start/ClientAppStart.js`)
- App startup → Client navigation: starts client shell
- Client navigation → Client home: shows home (evidence: `src/client-app/navigation/ClientMainScreen.jsx`)
- Client navigation → Navigation layout: positions navigation (evidence: `src/client-app/navigation/ClientMainScreen.jsx`)
- Food search → Food result cleanup: cleans results (evidence: `src/nutrition/food-search/tidyFoodTitles.js`)
- Food search → Save logged food: saves selected food (evidence: `src/nutrition/food-search/FoodSearchScreen.js`)
- Daily food log → Save logged food: uses food logging (evidence: `src/nutrition/daily-log/DailyLogContent.jsx`)
- Coach home → Coach conversation: opens conversation
- Coach conversation → Action confirmation rules: checks proposed actions (evidence: `src/ai-coach/conversation/CoachConversationScreen.jsx`)
- Express API → Food API routes: registers routes
- Express API → Coach request handler: dispatches requests (evidence: `server/index.js`)
- Coach request handler → Coach web search: invokes search (evidence: `server/lib/aiCoach/coachRequestHandler.js`)
- Coach request handler → LLM providers: calls providers (evidence: `server/lib/aiCoach/coachRequestHandler.js`)
- Client or trainer → Trainer app: uses trainer tools
- Client or trainer → Shared file handling: shares files
- Client or trainer → Firebase functions: triggers services
- Shared header → Navigation layout: shares shell layout
