# deepukishore/deeplyfit_test architecture

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

- Interactive diagram: https://gitdiagram.com/deepukishore/deeplyfit_test
- Repository: https://github.com/deepukishore/deeplyfit_test

## Overview

Deeply Fit is a fitness and nutrition platform with web and mobile clients backed by a shared FastAPI service. Users create an account and complete goal-based onboarding, then track meals and health activity, review progress, and optionally use coaching, community, and subscription features. Both clients call the backend; the web diary additionally supports cached and queued offline changes. The graph preserves README-documented product areas, while some internal links are limited to explicit imports in the supplied source index or excerpts.

Main entry points: [`backend/main.py`](https://github.com/deepukishore/deeplyfit_test/blob/main/backend/main.py) (FastAPI application), [`backend/routes/food_logs.py`](https://github.com/deepukishore/deeplyfit_test/blob/main/backend/routes/food_logs.py) (Food logging and search), [`frontend/src/App.js`](https://github.com/deepukishore/deeplyfit_test/blob/main/frontend/src/App.js) (Web application), [`mobile/index.js`](https://github.com/deepukishore/deeplyfit_test/blob/main/mobile/index.js) (Mobile application)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_clients["Web and mobile clients"]
  node_web["Web application<br/>[App.js]"]
  node_mobile["Mobile application<br/>[index.js]"]
  node_web_auth["Web authentication<br/>[AuthContext.js]"]
  node_web_diary["Web food diary<br/>[Diary.js]"]
  node_web_cache[("Offline diary cache<br/>[diaryStorage.js]")]
  node_mobile_nav["Mobile navigation<br/>[AppNavigator.js]"]
  node_mobile_auth["Mobile authentication<br/>[AuthContext.js]"]
  node_mobile_diary["Mobile food diary<br/>[Diary.js]"]
  node_mobile_storage[("Mobile local storage<br/>[storage.js]")]
  node_steps["Device step tracking<br/>[useStepCounter.js]"]
end

subgraph group_api["Backend API domains"]
  node_api["FastAPI application<br/>[main.py]"]
  node_auth_routes["Accounts and sessions<br/>[auth.py]"]
  node_user_routes["Profiles and goals<br/>[users.py]"]
  node_food_routes["Food logging and search<br/>[food_logs.py]"]
  node_activity_routes["Activity and steps<br/>[activity.py]"]
  node_workout_routes["Workouts and progress<br/>[workouts.py]"]
  node_wellness_routes["Water and weight<br/>[water_logs.py]"]
  node_meal_routes["Meal plans and templates<br/>[meal_plans.py]"]
  node_community_routes["Community and challenges<br/>[community.py]"]
  node_ai_routes["AI coaching<br/>[ai_chat.py]"]
  node_payment_routes["Subscriptions and payments<br/>[payments.py]"]
end

subgraph group_core["Backend core and data"]
  node_database[("SQL database<br/>[database.py]")]
  node_models["Domain data models<br/>[models.py]"]
  node_jwt["JWT and password helpers<br/>[jwt.py]"]
  node_food_ai["Food analysis and suggestions<br/>[gemini_food.py]"]
  node_food_lookup["Food data lookup<br/>[open_food_facts.py]"]
end

subgraph group_integrations["External services"]
  node_gemini{{"Google Gemini"}}
  node_off{{"Open Food Facts"}}
  node_razorpay{{"Razorpay"}}
end

node_person(("Fitness user"))

node_person -->|"uses"| node_web
node_person -->|"uses"| node_mobile
node_web -->|"provides context"| node_web_auth
node_web -->|"routes to"| node_web_diary
node_mobile -->|"provides context"| node_mobile_auth
node_mobile -->|"starts navigation"| node_mobile_nav
node_mobile_nav -->|"routes to"| node_mobile_diary
node_web_auth -->|"sets account"| node_web_cache
node_web_diary -->|"reads and queues"| node_web_cache
node_mobile_auth -->|"stores account"| node_mobile_storage
node_mobile_diary -->|"uses storage"| node_mobile_storage
node_web -->|"calls API"| node_api
node_mobile -->|"calls API"| node_api
node_api -->|"registers"| node_auth_routes
node_api -->|"registers"| node_user_routes
node_api -->|"registers"| node_food_routes
node_api -->|"registers"| node_activity_routes
node_api -->|"registers"| node_workout_routes
node_api -->|"registers"| node_wellness_routes
node_api -->|"registers"| node_meal_routes
node_api -->|"registers"| node_community_routes
node_api -->|"registers"| node_ai_routes
node_api -->|"registers"| node_payment_routes
node_auth_routes -->|"creates tokens"| node_jwt
node_auth_routes -->|"queries accounts"| node_database
node_auth_routes -->|"uses entities"| node_models
node_user_routes -->|"queries user data"| node_database
node_user_routes -->|"uses entities"| node_models
node_food_routes -->|"queries food logs"| node_database
node_food_routes -->|"uses entities"| node_models
node_food_routes -->|"looks up foods"| node_food_lookup
node_food_routes -->|"requests suggestions"| node_food_ai
node_models -->|"uses base"| node_database
node_food_ai -.->|"analyzes with"| node_gemini
node_food_lookup -.->|"queries food data"| node_off
node_ai_routes -.->|"coaches with"| node_gemini
node_payment_routes -.->|"processes payments"| node_razorpay
node_steps -.->|"syncs steps"| node_activity_routes

click node_web "https://github.com/deepukishore/deeplyfit_test/blob/main/frontend/src/App.js"
click node_mobile "https://github.com/deepukishore/deeplyfit_test/blob/main/mobile/index.js"
click node_web_auth "https://github.com/deepukishore/deeplyfit_test/blob/main/frontend/src/context/AuthContext.js"
click node_web_diary "https://github.com/deepukishore/deeplyfit_test/blob/main/frontend/src/pages/Diary.js"
click node_web_cache "https://github.com/deepukishore/deeplyfit_test/blob/main/frontend/src/utils/diaryStorage.js"
click node_mobile_nav "https://github.com/deepukishore/deeplyfit_test/blob/main/mobile/src/navigation/AppNavigator.js"
click node_mobile_auth "https://github.com/deepukishore/deeplyfit_test/blob/main/mobile/src/context/AuthContext.js"
click node_mobile_diary "https://github.com/deepukishore/deeplyfit_test/blob/main/mobile/src/pages/Diary.js"
click node_mobile_storage "https://github.com/deepukishore/deeplyfit_test/blob/main/mobile/src/utils/storage.js"
click node_steps "https://github.com/deepukishore/deeplyfit_test/blob/main/mobile/src/hooks/useStepCounter.js"
click node_api "https://github.com/deepukishore/deeplyfit_test/blob/main/backend/main.py"
click node_auth_routes "https://github.com/deepukishore/deeplyfit_test/blob/main/backend/routes/auth.py"
click node_user_routes "https://github.com/deepukishore/deeplyfit_test/blob/main/backend/routes/users.py"
click node_food_routes "https://github.com/deepukishore/deeplyfit_test/blob/main/backend/routes/food_logs.py"
click node_activity_routes "https://github.com/deepukishore/deeplyfit_test/blob/main/backend/routes/activity.py"
click node_workout_routes "https://github.com/deepukishore/deeplyfit_test/blob/main/backend/routes/workouts.py"
click node_wellness_routes "https://github.com/deepukishore/deeplyfit_test/blob/main/backend/routes/water_logs.py"
click node_meal_routes "https://github.com/deepukishore/deeplyfit_test/blob/main/backend/routes/meal_plans.py"
click node_community_routes "https://github.com/deepukishore/deeplyfit_test/blob/main/backend/routes/community.py"
click node_ai_routes "https://github.com/deepukishore/deeplyfit_test/blob/main/backend/routes/ai_chat.py"
click node_payment_routes "https://github.com/deepukishore/deeplyfit_test/blob/main/backend/routes/payments.py"
click node_database "https://github.com/deepukishore/deeplyfit_test/blob/main/backend/database.py"
click node_models "https://github.com/deepukishore/deeplyfit_test/blob/main/backend/models.py"
click node_jwt "https://github.com/deepukishore/deeplyfit_test/blob/main/backend/auth/jwt.py"
click node_food_ai "https://github.com/deepukishore/deeplyfit_test/blob/main/backend/ai/gemini_food.py"
click node_food_lookup "https://github.com/deepukishore/deeplyfit_test/blob/main/backend/utils/open_food_facts.py"

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_web,node_mobile,node_web_auth,node_web_diary,node_web_cache,node_mobile_nav,node_mobile_auth,node_mobile_diary,node_mobile_storage,node_steps,node_person toneBlue
class node_api,node_auth_routes,node_user_routes,node_food_routes,node_activity_routes,node_workout_routes,node_wellness_routes,node_meal_routes,node_community_routes,node_ai_routes,node_payment_routes toneAmber
class node_database,node_models,node_jwt,node_food_ai,node_food_lookup toneMint
class node_gemini,node_off,node_razorpay toneRose
```

## Components

### Web and mobile clients

- [Web application](https://github.com/deepukishore/deeplyfit_test/blob/main/frontend/src/App.js): `frontend/src/App.js`
- [Mobile application](https://github.com/deepukishore/deeplyfit_test/blob/main/mobile/index.js): `mobile/index.js`
- [Web authentication](https://github.com/deepukishore/deeplyfit_test/blob/main/frontend/src/context/AuthContext.js): `frontend/src/context/AuthContext.js`
- [Web food diary](https://github.com/deepukishore/deeplyfit_test/blob/main/frontend/src/pages/Diary.js): `frontend/src/pages/Diary.js`
- [Offline diary cache](https://github.com/deepukishore/deeplyfit_test/blob/main/frontend/src/utils/diaryStorage.js): `frontend/src/utils/diaryStorage.js`
- [Mobile navigation](https://github.com/deepukishore/deeplyfit_test/blob/main/mobile/src/navigation/AppNavigator.js): `mobile/src/navigation/AppNavigator.js`
- [Mobile authentication](https://github.com/deepukishore/deeplyfit_test/blob/main/mobile/src/context/AuthContext.js): `mobile/src/context/AuthContext.js`
- [Mobile food diary](https://github.com/deepukishore/deeplyfit_test/blob/main/mobile/src/pages/Diary.js): `mobile/src/pages/Diary.js`
- [Mobile local storage](https://github.com/deepukishore/deeplyfit_test/blob/main/mobile/src/utils/storage.js): `mobile/src/utils/storage.js`
- [Device step tracking](https://github.com/deepukishore/deeplyfit_test/blob/main/mobile/src/hooks/useStepCounter.js): `mobile/src/hooks/useStepCounter.js`

### Backend API domains

- [FastAPI application](https://github.com/deepukishore/deeplyfit_test/blob/main/backend/main.py): `backend/main.py`
- [Accounts and sessions](https://github.com/deepukishore/deeplyfit_test/blob/main/backend/routes/auth.py): `backend/routes/auth.py`
- [Profiles and goals](https://github.com/deepukishore/deeplyfit_test/blob/main/backend/routes/users.py): `backend/routes/users.py`
- [Food logging and search](https://github.com/deepukishore/deeplyfit_test/blob/main/backend/routes/food_logs.py): `backend/routes/food_logs.py`
- [Activity and steps](https://github.com/deepukishore/deeplyfit_test/blob/main/backend/routes/activity.py): `backend/routes/activity.py`
- [Workouts and progress](https://github.com/deepukishore/deeplyfit_test/blob/main/backend/routes/workouts.py): `backend/routes/workouts.py`
- [Water and weight](https://github.com/deepukishore/deeplyfit_test/blob/main/backend/routes/water_logs.py): `backend/routes/water_logs.py`
- [Meal plans and templates](https://github.com/deepukishore/deeplyfit_test/blob/main/backend/routes/meal_plans.py): `backend/routes/meal_plans.py`
- [Community and challenges](https://github.com/deepukishore/deeplyfit_test/blob/main/backend/routes/community.py): `backend/routes/community.py`
- [AI coaching](https://github.com/deepukishore/deeplyfit_test/blob/main/backend/routes/ai_chat.py): `backend/routes/ai_chat.py`
- [Subscriptions and payments](https://github.com/deepukishore/deeplyfit_test/blob/main/backend/routes/payments.py): `backend/routes/payments.py`

### Backend core and data

- [SQL database](https://github.com/deepukishore/deeplyfit_test/blob/main/backend/database.py): `backend/database.py`
- [Domain data models](https://github.com/deepukishore/deeplyfit_test/blob/main/backend/models.py): `backend/models.py`
- [JWT and password helpers](https://github.com/deepukishore/deeplyfit_test/blob/main/backend/auth/jwt.py): `backend/auth/jwt.py`
- [Food analysis and suggestions](https://github.com/deepukishore/deeplyfit_test/blob/main/backend/ai/gemini_food.py): `backend/ai/gemini_food.py`
- [Food data lookup](https://github.com/deepukishore/deeplyfit_test/blob/main/backend/utils/open_food_facts.py): `backend/utils/open_food_facts.py`

### External services

- **Google Gemini**
- **Open Food Facts**
- **Razorpay**

### Other components

- **Fitness user**

## Connections

- Fitness user → Web application: uses
- Fitness user → Mobile application: uses
- Web application → Web authentication: provides context (evidence: `frontend/src/App.js`)
- Web application → Web food diary: routes to (evidence: `frontend/src/App.js`)
- Mobile application → Mobile authentication: provides context (evidence: `mobile/index.js`)
- Mobile application → Mobile navigation: starts navigation (evidence: `mobile/index.js`)
- Mobile navigation → Mobile food diary: routes to (evidence: `mobile/src/navigation/AppNavigator.js`)
- Web authentication → Offline diary cache: sets account (evidence: `frontend/src/context/AuthContext.js`)
- Web food diary → Offline diary cache: reads and queues (evidence: `frontend/src/pages/Diary.js`)
- Mobile authentication → Mobile local storage: stores account (evidence: `mobile/src/context/AuthContext.js`)
- Mobile food diary → Mobile local storage: uses storage
- Web application → FastAPI application: calls API
- Mobile application → FastAPI application: calls API
- FastAPI application → Accounts and sessions: registers (evidence: `backend/main.py`)
- FastAPI application → Profiles and goals: registers (evidence: `backend/main.py`)
- FastAPI application → Food logging and search: registers (evidence: `backend/main.py`)
- FastAPI application → Activity and steps: registers (evidence: `backend/main.py`)
- FastAPI application → Workouts and progress: registers (evidence: `backend/main.py`)
- FastAPI application → Water and weight: registers (evidence: `backend/main.py`)
- FastAPI application → Meal plans and templates: registers (evidence: `backend/main.py`)
- FastAPI application → Community and challenges: registers (evidence: `backend/main.py`)
- FastAPI application → AI coaching: registers (evidence: `backend/main.py`)
- FastAPI application → Subscriptions and payments: registers (evidence: `backend/main.py`)
- Accounts and sessions → JWT and password helpers: creates tokens (evidence: `backend/routes/auth.py`)
- Accounts and sessions → SQL database: queries accounts (evidence: `backend/routes/auth.py`)
- Accounts and sessions → Domain data models: uses entities (evidence: `backend/routes/auth.py`)
- Profiles and goals → SQL database: queries user data (evidence: `backend/routes/users.py`)
- Profiles and goals → Domain data models: uses entities (evidence: `backend/routes/users.py`)
- Food logging and search → SQL database: queries food logs (evidence: `backend/routes/food_logs.py`)
- Food logging and search → Domain data models: uses entities (evidence: `backend/routes/food_logs.py`)
- Food logging and search → Food data lookup: looks up foods (evidence: `backend/routes/food_logs.py`)
- Food logging and search → Food analysis and suggestions: requests suggestions (evidence: `backend/routes/food_logs.py`)
- Domain data models → SQL database: uses base (evidence: `backend/models.py`)
- Food analysis and suggestions → Google Gemini: analyzes with
- Food data lookup → Open Food Facts: queries food data
- AI coaching → Google Gemini: coaches with
- Subscriptions and payments → Razorpay: processes payments
- Device step tracking → Activity and steps: syncs steps
